Copied to clipboard

Flag this post as spam?

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


  • Collin 42 posts 62 karma points
    Sep 09, 2011 @ 10:33
    Collin
    0

    Hiding menu items in custom menu to which the user doesn't have access rights to

    The following code is used to display a custom menu:

                <xsl:for-each select="umbraco.library:GetXmlNodeById(@id)/node [string(data [@alias='showInTopMenu']) = '1']">
                    <li class="LevelTwo">
                        <a href="{umbraco.library:NiceUrl(@id)}" target="_top"><span><xsl:value-of select="string(data [@alias='pageTitle'])"/></span></a>
                    </li>
                </xsl:for-each>

    The problem with this approach is that this also shows pages that the user doesn't have access rights to. These pages shouldn't be displayed when the user is logged in and isn't part of the member group that has the access rights.

    I can't find the documentation for adapting the above code so that it checks if the user is part of a member group that has access. Could someone point me in the right direction for achieving this?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 09, 2011 @ 10:39
    Dirk De Grave
    0

    Colin,

    use IsLoggedOn() and HasAccess() xslt extension functions to find out if a member is logged on and has access to a specific page.

     

    Cheers,

    /Dirk

  • Collin 42 posts 62 karma points
    Sep 09, 2011 @ 10:53
    Collin
    0

    Thanks the HasAccess solved it for me (they see a different template with a different menu if they aren't logged in).

     

Please Sign in or register to post replies

Write your reply to:

Draft