Copied to clipboard

Flag this post as spam?

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


  • Doug 7 posts 27 karma points
    Jul 25, 2013 @ 21:52
    Doug
    0

    filtering tree data for users and members

    I am trying to filter the users and members tree. So if a user in Company A logs in, that user can only see other users and memebers that are part of Company A.

    I thought I rember seeing a forum post that had some sample code on how to apply a filter to the tree, but after 2 hours of looking I just can't find it.

    Thanks!

  • Doug 7 posts 27 karma points
    Aug 27, 2013 @ 06:25
    Doug
    0

    If anyone has any idea how to go about this it would be greatly appreciated. I'm at a point where its a show stopper for me.

    Thanks!

  • Doug 7 posts 27 karma points
    Aug 29, 2013 @ 06:53
    Doug
    0

    I was able to get half way there, the filtered user tree is working, but the members tree is still a challenge.

    Here is the Filtered User Tree:

    using System;
    using umbraco.BusinessLogic;
    using umbraco.cms.presentation.Trees;
    using umbraco.interfaces;


    public class FilterMemberTree : IApplicationStartupHandler
    {

        public FilterMemberTree()
        {
            BaseContentTree.AfterNodeRender += new BaseTree.AfterNodeRenderEventHandler(BaseContentTree_AfterNodeRender);      
        }

        void BaseContentTree_AfterNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
        {
            if (node.TreeType == "users")
            {

                //do custom filtering here

            }

        }

    }

    So the BaseContentTree_AfterNodeRender method is called every time a node in the tree is rendered, for the content tree, media tree, user tree, everything EXCEPT the members tree (UGHHHHHH)!

    So I tried to add an event to the MemberContentTree instead of BaseTree, but all it does is add the event to the base tree and not the Member tree:

    MemberContentTree.AfterNodeRender += new BaseTree.AfterNodeRenderEventHandler(MemberContentTree_AfterNodeRender);

    Any ideas?

Please Sign in or register to post replies

Write your reply to:

Draft