Copied to clipboard

Flag this post as spam?

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


  • Dan 1288 posts 3921 karma points c-trib
    Apr 11, 2011 @ 11:35
    Dan
    0

    Get member group names from member id

    Hi,

    I'm using the GetGroupsByMemberId method to output the names of the groups to which a particular member belongs.  However, I'm not sure what this returns in terms of specific XML structure, so I'm not sure how to parse the output into a list of group names.

    I have this:

    <xsl:variable name="memberId" select="number(umbraco.library:GetCurrentMember()/@id)"/>
    <p>The current member id is: <xsl:value-of select="$memberId"/></p>
    <p>The groups this member belongs to are:</p>
    <xsl:variable name="memberGroups" select="ucomponents.members:GetGroupsByMemberId($memberId)"/>

    I've tried outputting the value of $memberGroups inside a textarea, but it doesn't output anything.

    Does anyone know how to output a list of group names from this?

    Thanks

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 11, 2011 @ 13:04
    Lee Kelleher
    1

    Hi Dan,

    Hmmm... starting to think that there's a bug in there somewhere?  Haven't had chance to debug the code yet - will do soon!

    As for the XML, it should look like this...

    <memberGroups>
        <memberGroup>Group Name 1</memberGroup>
        <memberGroup>Group Name 2</memberGroup>
    </memberGroups>

    I'll let you know what I find with my debugging.

    Cheers, Lee.

  • Dan 1288 posts 3921 karma points c-trib
    Apr 11, 2011 @ 13:06
    Dan
    0

    Nice one, thanks Lee!

  • Dan 1288 posts 3921 karma points c-trib
    Apr 11, 2011 @ 18:20
    Dan
    0

    No need to debug Lee, it works.  Just me being very stupid! :)

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 11, 2011 @ 18:25
    Lee Kelleher
    0

    Ah cool... dare I ask what happened? ;-)

  • Dan 1288 posts 3921 karma points c-trib
    Apr 11, 2011 @ 18:36
    Dan
    1

    Put it this way... members need to be assigned to member groups ;)  Yes - utterly shameful!  Found this after I'd pulled apart uComponents and written my own version of the extension, for it not to work either.  I can't even blame lack of sleep at the moment as the kids are away. Doh!

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 11, 2011 @ 18:42
    Lee Kelleher
    0

    Well, that's made me smile!  Only in a "been there, done that" kinda way! :-)

Please Sign in or register to post replies

Write your reply to:

Draft