Copied to clipboard

Flag this post as spam?

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


  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Apr 04, 2011 @ 16:45
    Jeroen Breuer
    0

    Hide node in the backend

    Hello,

    Is it possible to hide a node in the backend? I've got a node in the website which only the admin is allowed to see, but it's not possible for me to set a start node for the other users (they need to be on level). How can I hide a node in the tree for other users?

    Jeroen

  • Rich Green 2246 posts 4008 karma points
    Apr 04, 2011 @ 16:52
    Rich Green
    0

    Hi Jeroen,

    You can use

     sender.Remove(node);

    Rich

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Apr 04, 2011 @ 16:52
    Richard Soeteman
    0

    Hi Jeroen,

    I've used the event system for this in the past. Check demo 4 of my blogpost http://www.richardsoeteman.net/2009/02/22/UmbracoV4EventsDemo.aspx

    What's the criteria to hide a node?

    Cheers,

    Richard

  • Rich Green 2246 posts 4008 karma points
    Apr 04, 2011 @ 16:55
    Rich Green
    3

    Fuller example

    public class TreeEvents : ApplicationBase
    {
        public TreeEvents()
            {
                umbraco.cms.presentation.Trees.BaseTree.AfterNodeRender += new umbraco.cms.presentation.Trees.BaseTree.AfterNodeRenderEventHandler(BaseTree_AfterNodeRender);
            }
    
         private void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
            {
    
            //Logic to find node to hide
            sender.Remove(node);
    
        }
    }

    Rich

  • Gerben 41 posts 136 karma points
    Apr 04, 2011 @ 18:21
    Gerben
    0

    Hi Jeroen, I think you can use permissions to hide nodes from specific users. I don't know exactly which permissions settings, but I have used this in the past to hide specific pages from specific content managers. 

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Apr 04, 2011 @ 19:59
    Richard Soeteman
    0

    Yep that might also be a possibilty disable browse for that node. By default you can only set permissions for individual users. When you want to disable for complete groups checkout the Usergroup permissions package.

    http://our.umbraco.org/projects/backoffice-extensions/usergroup-permissions

    Cheers,

    Richard

  • Edwin van Koppen 156 posts 270 karma points
    Dec 11, 2012 @ 16:12
    Edwin van Koppen
    0

    Old post but maybe for ppl who go searching, i got a other solution:

    public class TreeEvents : AppEvents {
            public TreeEvents() {
                BaseTree.AfterNodeRender += new BaseTree.AfterNodeRenderEventHandler(BaseTree_AfterNodeRender);
            }

            private void BaseTree_AfterNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e) {
                XPathNodeIterator nodeData = umbraco.library.GetXmlNodeById(node.NodeID);
                if (nodeData.Current.Name == "NewsOverview") {
                    node.HasChildren = false;
                }
            }
        }

    and AppEvents is a class of the type IApplicationEventHandler (that must implement OnApplicationInitialized, OnApplicationStarting, OnApplicationStarted)

    the only thing you erase with this is the children option so it won't open up (and you also don't have that ugly > before the node!)

Please Sign in or register to post replies

Write your reply to:

Draft