Copied to clipboard

Flag this post as spam?

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


  • davelane 29 posts 73 karma points
    Aug 08, 2011 @ 21:22
    davelane
    0

    Help with GetMembersByGroupName in members XSLT library

    Hey all,

    I am using the uComponents package, which is fantastic, and I can't find documentation or forum entries to help me list members on the front-end of my website using GetMembersByGroupName.

    Can anyone help me use this method? I've had some success using apply-template, but it just spits out a single string of Names and I'd like to have more control over this.

    Ideally would like to list entire profiles as stored in the membership directory. Can you help?

    Thank you!!
    Dave

  • Ronnie Hegelund 48 posts 710 karma points
    Aug 09, 2011 @ 08:23
    Ronnie Hegelund
    0

    Have you tryed using the umbraco.library:Split command try split with a ',' or '|'

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Aug 10, 2011 @ 11:31
    Lee Kelleher
    0

    Hi Dave,

    Yeah, the documentation isn't the best - usually my fault, I get carried away developing new extensions - not enought time on documentation! ;-)

    OK, example snippets!

    Calling the extension directly in an apply-templates, like so...

    <xsl:apply-templates select="ucomponents.members:GetMembersByGroupName('uComponents')" />

    This would return the following XML nodeset:

    <members>
        <member>Lee Kelleher</member>
        <member>Ronnie Hegelund</member>
    </members>

    The pointer for the nodeset should be set to the root <members> node, so you'd have the following templates in place:

    <xsl:template match="members">
        <ul>
            <xsl:apply-template select="member" />
        </ul>
    </xsl:template>
    
    <xsl:template match="member">
        <li>
            <xsl:value-of select="text()" />
        </li>
    </xsl:template>

    First the "members" template is matched, then inside there we can define any wrapping elements, like <ul> tag. Then we apply the "member" template ... which would output the <li> and member's name.

    The reason we only use the member's name (and no other details), is because that's all the underlying membership provider can provide (using "Roles.GetUsersInRole").

    Cheers, Lee.

    Cheers, Lee.

  • davelane 29 posts 73 karma points
    Aug 12, 2011 @ 16:24
    davelane
    0

    Thanks Lee!

Please Sign in or register to post replies

Write your reply to:

Draft