0

I have a small issue with hiding a certain menu item upon login in Umbraco / XSLT.

I have this piece of XSLT that outputs menu items

<li>
    <a href="{$url}" class="{$class}">      
        <xsl:if test="$currentPage/ancestor-or-self::*/@id = ./@id">
            <xsl:attribute name="class">active</xsl:attribute>
            <xsl:if test="$node/@level = 3">
                <i class="{$iconClass}"></i>
            </xsl:if>
        </xsl:if>   
        <xsl:value-of select="$node/@nodeName" />           
    </a>
    <xsl:if test="$active">
        <xsl:call-template name="list">
            <xsl:with-param name="parent" select="$node" />
        </xsl:call-template>    
    </xsl:if>
</li>

What I want is to be able to exlude menu items that have true in the property "hideAtLogin", upon login.

I have tried with

<xsl:if test="umbraco.library:IsLoggedOn = 'false' and hideAtLogin = ''">
...
</xsl:if>

But that doesn't work...

when hideAtLogin isn't selected (= false), the item should be shown regardless of login or not.

Morten Hagh
  • 2,055
  • 8
  • 34
  • 66

2 Answers2

0

Just 2 suggestions:
Have you already tried to change

 <xsl:if test="umbraco.library:IsLoggedOn = 'false' ..">..</xsl:if>

into

 <xsl:if test="umbraco.library:IsLoggedOn() = false() ..">..</xsl:if>

and in case this still won't work, could it be a server issue as mentioned here for someone with a similar problem?

Umbraco.Library.IsLoggedOn() does not work from XSLT

Issue there was that the session was not available by XSLT because of server configuration and the web.config had to be adjusted.

Community
  • 1
  • 1
matthias_h
  • 11,356
  • 9
  • 22
  • 40
0

Got it to work with

<xsl:if test="not(umbraco.library:IsLoggedOn()) or (umbraco.library:IsLoggedOn() and hideAtLogin != 1)">
...
</xsl:if>
Morten Hagh
  • 2,055
  • 8
  • 34
  • 66