Copied to clipboard

Flag this post as spam?

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


  • Mohsin 12 posts 71 karma points
    Jul 10, 2013 @ 12:27
    Mohsin
    0

    Approve User Umbraco membership


    hi i am working on Umbraco(6.1.2) membership system
    ive made login ,registration, and authentication page
    after registeration user is redirected to authentication page with token_id

    now i want to set this user approved for this purpose i write the following code
    but there is some error check it

    string uname = Request.QueryString["a"];
    string uguid = Request.QueryString["b"];

    MembershipUser thisUser = Membership.GetUser(uname);
    if (thisUser != null)
    {
    if (!thisUser.IsApproved)
    {
    MemberProfile mp = MemberProfile.GetUserProfile(uname);
    if (mp != null)
    {
    if (mp.AuthGuid == uguid)
    {
    thisUser.IsApproved = true;
    Membership.UpdateUser(thisUser);
    lblMessage.Text = "Thank you for confirming your email address";
    }
    else
    {
    lblMessage.Text = "Error confirming your email address";
    }
    }
    else
    {
    lblMessage.Text = "Error confirming your email address";
    }
    }
    else
    {
    lblMessage.Text = "Email address is already confirmed";
    }
    }
    else
    {
    lblMessage.Text = "User not found";
    }



    control is return to else condition from this condition "if (!thisUser.IsApproved)"

    and also if i reverse the condition it gets into if block and executes all commands without errors but still not mark user as approved

    plz help me

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 10, 2013 @ 12:32
    Jeroen Breuer
    0

    If you don't mind using the Umbraco API this blog might help: http://www.nibble.be/?p=66

    Jeroen

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 10, 2013 @ 12:35
    Jeroen Breuer
    0

    This blog might help: http://www.nibble.be/?p=66

    Jeroen

  • Charles Afford 1163 posts 1709 karma points
    Jul 10, 2013 @ 22:33
    Charles Afford
    0

    Yea i would use the final url Jeroen posted.  Has the umbraco API now been phased out?  does it not use the ASP.net membership provider?

    In a nut shell, 

    Get the user

    Create a profile base

    Get the approved property (this will be a checkbox)

    Do your work

    Set the property or return an error / message

    save profile base

    return

    Hope this helps.  Charlie :)

  • Mohsin 12 posts 71 karma points
    Jul 11, 2013 @ 05:39
    Mohsin
    0

    Charles 

    i am using umbracomembershipprovider not using ASP.net membershipprovider

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 11, 2013 @ 09:17
    Jeroen Breuer
    0

    Hello,

    The member api will get a new version, but the old api is still the best thing for now. The obsolete attributes have even been removed again in the latest version of Umbraco: https://github.com/umbraco/Umbraco-CMS/commit/7c6aee17e90d4b59a29cbcabf915475510c072c7

    New member api: http://issues.umbraco.org/issue/U4-1659

    So this documentation is still good: http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-members

    Jeroen

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 11, 2013 @ 09:22
  • Charles Afford 1163 posts 1709 karma points
    Jul 11, 2013 @ 21:47
    Charles Afford
    0

    Sorry just what i read?  So can you still use the Umbraco member api Jeroen?  Charlie :)

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 11, 2013 @ 22:01
    Jeroen Breuer
    0

    Yes the Umbraco member api is still the best thing to use.

    Jeroen

  • Charles Afford 1163 posts 1709 karma points
    Jul 11, 2013 @ 22:45
    Charles Afford
    0

    Ok, thanks :).  Should i use that to access custom member properties?  I read somewhere you had to do it thought profile base and not the api?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies