Copied to clipboard

Flag this post as spam?

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


  • Daniel Larsen 116 posts 381 karma points
    Jul 30, 2013 @ 11:26
    Daniel Larsen
    0

    Set member property

    Hi, I am trying to make it possible for a member (not user) to change it's own info like email, phone etc. 

    I have a working change password macro, that looks like this:

    var m = System.Web.Security.Membership.GetUser();
    var passwd = Request.QueryString["password"];
    m.ChangePassword(m.ResetPassword(), @passwd);

    I was wondering, if I could do something similar in razor, with the custom properties?

    This did not help me, but it looks like something usefull. http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-members

    Umbraco v 4.11.4

    Thank you!

    Daniel

     

     

     

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 30, 2013 @ 12:17
    Jeroen Breuer
    0

    Hello,

    Why doesn't that cheatsheet work for you? It's a different API, but it's still the best to use. Read more here:

    http://our.umbraco.org/forum/developers/api-questions/42337-How-to-create-members-and-assign-to-roles-using-API-in-Umbraco-6x#comment153737

    Jeroen

  • Daniel Larsen 116 posts 381 karma points
    Jul 30, 2013 @ 13:46
    Daniel Larsen
    0

    I don't know, why it is not working. I try to do this, but it dosnt work.

    @using umbraco.cms.businesslogic.member
    
    @{
    
    var m = System.Web.Security.Membership.GetUser();
    var newLocal= Request.QueryString["local"];
    
    @m.getProperty("empLocal").Value.ToString("@newLocal");
    
    }
    

    What am I doing wrong?

    Thank you :-)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 30, 2013 @ 13:59
    Jeroen Breuer
    0

    Because 

    var m = System.Web.Security.Membership.GetUser();

    Is a different API. It's not the Umbraco Member API.

    Try this:

    @using umbraco.cms.businesslogic.member;
    @{
    var m = new Member(System.Web.Security.Membership.GetUser().ProviderUserKey);
    var newLocal = Request.QueryString["local"];
    m.getProperty("empLocal").Value = newLocal;

    Jeroen

     

  • Daniel Larsen 116 posts 381 karma points
    Jul 30, 2013 @ 14:19
    Daniel Larsen
    0
    var m = new Member(System.Web.Security.Membership.GetUser().ProviderUserKey);
    

    error CS1502: The best overloaded method match for 'umbraco.cms.businesslogic.member.Member.Member(int)' has some invalid arguments

    I get this error, but I dont know what is wrong with it?

    Thank you for the quick answer :-)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 30, 2013 @ 14:25
    Jeroen Breuer
    100

    Hmm try this:

    var m = new Member(Convert.ToInt32(System.Web.Security.Membership.GetUser().ProviderUserKey));

    Jeroen

  • Daniel Larsen 116 posts 381 karma points
    Jul 30, 2013 @ 14:55
    Daniel Larsen
    0

    Thank you! That did the trick! :-D

Please Sign in or register to post replies

Write your reply to:

Draft