Copied to clipboard

Flag this post as spam?

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


  • bobby 1 post 21 karma points
    Jun 02, 2014 @ 14:43
    bobby
    0

    How can I have private and public menu item that hide/show based on user authentication?

    I have two menu items (OurProducts and Products) along with Home, Abount Us, etc. OurProducts is for authenticated users only as it contains detailed information. I want to hide OurProducts menu item from the nav bar for unauthenticated users and when they authenticate, display OurProducts and hide Products. I have looked around but cannot find anything to accomplish this. I can only get up to displaying OurProducts only for logged in users but unable to hide Products. Is this achievable?

    My XSLT is as follows:

    <xsl:output method="xml" omit-xml-declaration="yes" />

        <xsl:param name="currentPage"/>

        <!-- Input the documenttype you want here -->

        <xsl:variable name="level" select="1"/>

       <xsl:template match="/">     

    <ul id="topNavigation" class="nav">

    <li><a href="/">Home</a></li>

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1' and string(hideInTopNav) != '1']">  

    <xsl:choose>

    <xsl:when test="@nodeName = 'OurProducts' and umbraco.library:IsLoggedOn() != 1">

    <li>

    <xsl:if test="@id = $currentPage/@id"> <xsl:attribute name="class">active</xsl:attribute> </xsl:if>  

    <a class="navigation" href="{umbraco.library:NiceUrl(@id)}"> <span><xsl:value-of select="@nodeName"/></span> </a>

    </li>

    </xsl:when>

    <xsl:otherwise>

    <li>

    <xsl:if test="@id = $currentPage/@id">

    <xsl:attribute name="class">active</xsl:attribute>

    </xsl:if>  

    <a class="navigation" href="{umbraco.library:NiceUrl(@id)}">

    <span><xsl:value-of select="@nodeName"/></span>

    </a>

    </li>

    </xsl:otherwise>

    </xsl:choose>

    </xsl:for-each>

    </ul>

        </xsl:template>

Please Sign in or register to post replies

Write your reply to:

Draft