Copied to clipboard

Flag this post as spam?

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


  • javier 59 posts 79 karma points
    Jun 08, 2010 @ 00:26
    javier
    0

    Hide menu to non authenticated users

    Hi,

    Is there a way to hide nodes for non authenticated users?

    When a new user get in the web page he is able to see the nodes that are protected with "public access" options. He is not able to see the content until login, but I want those nodes to be unavailable. How can I do that?


    Thanks

     

    Javier

  • javier 59 posts 79 karma points
    Jun 08, 2010 @ 00:50
    javier
    0

    BTW, I use RunwayDropdownNavigation.

    Is it the xslt that I have to modify? Some one can point me how to do it?
    Really thanks any help.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 08, 2010 @ 09:36
    Dirk De Grave
    0

    Javier,

    use

    umbraco.library:IsLoggedOn()

    in your xslt to check whether a user has rights to access a protected page.

     

    Hope this helps.

    Regards,

    /Dirk

  • javier 59 posts 79 karma points
    Jun 08, 2010 @ 10:47
    javier
    0

    Hi Dirk.

    Yep, that did it.

    I'm really new to xslt, maybe you can help me with this:

    How is the syntax of   if condition in xslt,

    I have:

    <xsl:for-each select="$parent/node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevel]">

                     if "node is protected" and umbraco.library:IsLoggedOn()=true then

                        ......

                  end if

    </xsl:for-each>

     

    Thanks for your help.


    javier

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 08, 2010 @ 11:41
    Dirk De Grave
    0

    Here's a code snippet taken from the default Sitemap.xslt that comes with any umbraco installation:

    <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
    And just need to make some adaptations to reflect your current situation:
    <xsl:if test="umbraco.library:IsProtected($currentPage/@id, $currentPage//@path) = 0 or (umbraco.library:IsProtected($currentPage//@id, $currentPage//@path) = 1 and umbraco.library:IsLoggedOn() = 1)">...</xsl:if>
    Hope this helps.
    Regards,
    /Dirk

  • javier 59 posts 79 karma points
    Jun 08, 2010 @ 16:58
    javier
    0

    Hi Dirk,

     

    It does not work. I'll play more with it.

     umbraco.library:IsProtected($currentPage/@id, $currentPage//@path) = 0  

    is that asking for the node that is in the previous for-each?

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 08, 2010 @ 17:06
    Dirk De Grave
    0

    Ha, in that case, you should use replace $currentPage with .

    <xsl:if test="umbraco.library:IsProtected(./@id, ./@path) = 0 or (umbraco.library:IsProtected(./@id, ./@path) = 1 and umbraco.library:IsLoggedOn() = 1)">...</xsl:if>

    I've made an extra small error as I was using // instead of /

     

    Hope this helps.

    Regards,

    /Dirk

  • javier 59 posts 79 karma points
    Jun 08, 2010 @ 17:52
    javier
    0

    yeeeeaaaaaaa!!!! That made it. I need to learn xslt syntax :s.

    Thanks :)

     

    For the record of any one looking for same thing. the code that draws the nodes in the Runway Dropdown Menu is:

     

    <xsl:template name="drawNodes">
    <xsl:param name="parent"/>

    <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
     <xsl:for-each select="$parent/node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevel]">
          <xsl:if test="umbraco.library:IsProtected(./@id, ./@path) = 0 or (umbraco.library:IsProtected(./@id, ./@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
      <li> 
      <a href="{umbraco.library:NiceUrl(@id)}">
      <xsl:value-of select="@nodeName"/></a> 
      <xsl:if test="count(./node [string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevel]) &gt; 0">  
       <ul>
        <xsl:call-template name="drawNodes">   
         <xsl:with-param name="parent" select="."/>   
        </xsl:call-template> 
       </ul>
      </xsl:if>
      </li>
                 </xsl:if>
     </xsl:for-each>
    </xsl:if>
    </xsl:template>

     

  • Tammy 16 posts 36 karma points
    May 31, 2011 @ 05:24
    Tammy
    0

    wow... ir works perfectly.

    thanks for sharing

Please Sign in or register to post replies

Write your reply to:

Draft