Copied to clipboard

Flag this post as spam?

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


  • Phillip Ng 148 posts 250 karma points
    Sep 25, 2013 @ 19:38
    Phillip Ng
    0

    Accessing member properties from MemberPicker

    Hi!

    Maybe I'm being really dense, but this is giving me some trouble and the forum suggestions don't seem to be helping. I am using a MemberPicker property on a content node to choose registered users to promote. I am able to get their node ID, but can't get their first name, last name, etc. Is the membership object still needed in this case? The code is something like this:

        var currentNode = umbraco.NodeFactory.Node.GetCurrent();
        var currentPremium = currentNode.GetPropertyString("memberPicker");    //this returns the ID of the member picked on the content node

     I appreciate any advice in advance. Thanks!

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Sep 25, 2013 @ 20:24
    Ali Sheikh Taheri
    0

    Hi Phillip,

    You can use the id with the function below to get the member object :

    var currentNode = umbraco.NodeFactory.Node.GetCurrent();
    var currentPremium = currentNode.GetPropertyString("memberPicker");
    var member = umbraco.library.GetMember(Convert.ToInt32(currentPremium));
    
  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Sep 25, 2013 @ 21:02
    Jeavon Leopold
    100

    Hi Phillip,

    I would recommend that you also take a look at the member picker documentation samples here

    There is also included there a sample using uQuery which is my favoured method for getting member data.

    Jeavon

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Sep 25, 2013 @ 21:06
    Jeavon Leopold
    0

    Also worth mentioning that Umbraco v6.2 will bring us a new Members Api (woohoo!)

  • Phillip Ng 148 posts 250 karma points
    Sep 25, 2013 @ 22:01
    Phillip Ng
    0

    Thanks guys. The uQuery example worked. Much appreciated!

Please Sign in or register to post replies

Write your reply to:

Draft