Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • TheMedievalCoder 4 posts 24 karma points
    Oct 19, 2012 @ 00:04
    TheMedievalCoder
    0

    Contour Registration can't get Username

    Hi,

    I have created a registration form using Contour, the fields are:

    - Firstname
    - Lastname
    - Username
    - Password
    - Email

    This form captures registrations no problem. 

    I have a asp.net membership login control which logs registered users, this works. It uses Email + Password for login. Not sure why it's using email, should be using Username, anyway, can fix this later.

    Now once the user logs in, I want to get the logged in Members full form details, I have this code in my template:

    @{
    @umbraco.cms.businesslogic.member.Member.GetCurrentMember();
    }

     This outputs:

      { Id: 1122, Text: TestLastname, ParentId: -1 } 

     

    I would like to get registration's full data output, I.e. Username, Firstname, Lastname etc. Is this possible?

    ANother question, 
    I have another form which captures comments, how can I assign the logged in username to these comments, currently the comments have no memberId assigned to them? The way I was going to do it was get the logged in username then save this value to the comments form as an additional field.

    I hope this all makes sense.I have strugged with this for over a week with no success. As you can tell I am new to Umbraco and Contour so any advice will be grately appreciated.

    Thanks.

  • TheMedievalCoder 4 posts 24 karma points
    Oct 19, 2012 @ 18:16
    TheMedievalCoder
    0

    I thought this would be a fairly easy one to solve for you masters!

    Any experts out there willing to help this poor feeble humble developer?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 19, 2012 @ 19:11
    Tom Fulton
    0

    Hi,

    To get the properties of a member, you can use something like:

    var member = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
    var prop = member.GetProperty("firstName").Value;

    There's also a different way of accessing properties if you want to write a custom profile class:  www.aaron-powell.com/umbraco-members-profiles

    Regarding the comments, I seem to recall that Contour saves the MemberID of a logged in member automatically when submitting the form.  Looking at the developer docs, I think it's saved as "memberkey".

     

     

    You can also use member values as defaults for inputs, so for instance you could have a hidden field for login name, and assign a default value {member.loginname} to have it populated automatically.

    Hope this helps,
    Tom 

     

     

     

  • TheMedievalCoder 4 posts 24 karma points
    Oct 19, 2012 @ 23:30
    TheMedievalCoder
    0

    Hi, thanks for the reply. I had already tried:

    var member = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
    var prop = member.GetProperty("firstName").Value;

    When I try this I get the following error:

    Error loading MacroEngine script (file: ) 

    I don't think GetCurrentMember has access to the 'firstname' property. It can only get:

      { Id: 1122, Text: TestLastname, ParentId: -1 } 


      Anything else I can try?
Please Sign in or register to post replies

Write your reply to:

Draft