Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Filter discussion posts by usergroup?

Hi. Is there any way to have a drop down menu that allows users to filter posts by usergroup? I'd like to create discussions where users can see all posts, or filter by posts from people in specific school groups. Thanks.

Comments

  • peregrineperegrine MVP
    edited January 2014

    Hi. Is there any way to have a drop down menu that allows users to filter posts by usergroup? I'd like to create discussions where users can see all posts, or filter by posts from people in specific school groups. Thanks.

    It depends how you fashion things. You can make categories available to certain roles

    so if one school group is chemistry role - they can see all chemistry categories
    so if one school group is geology role - they can see all geology categories

    • the general group could be viewable to all

    so define your roles

    then define your custom category permissions.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • I'll play around with that, but I'm not sure it will work. I'd like to have a discussion with members from School A, School B, and School C. The default is to see all discussions by all members, but if I want to see only what people from School A are saying, I would filter for them.

    Thanks for you help!

  • if all users for school A are in role schoolA
    if all users for school B are in role schoolB
    if all users for school C are in role schoolC

    you can certainly restrict viewing of categories - however you would have to define separate categories for each school and give role ability to view category via custom category permissions.

    And the general discussion should be open to every school to post.

    if I read you correctly on your desires.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • hgtonighthgtonight ∞ · New Moderator

    If it is optional, use tags.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Thanks to @peregrine and @hgtonight. I've been thinking about both solutions.

    With the role option, as I understand it, the schoolA role would only see posts by other schoolA role people. What I would like is a discussion showing all posts-- by schoolA people, schoolB people, schoolC people, general member people, etc. Then, if I was interested in only seeing what the schoolA people posted (regardless if I have a schoolA role or not), I could somehow filter/select them out.

    The tags option sounds like an easy way to filter/select, but it is up to the user to tag each post. Is there a way for a tag to automatically be added to all posts based on a user's role? For example, all posts by people in the schoolA role would automatically include a tag "School A." This would be set at the admin level and beyond the control of the user.

    Finally, I found an addon called "Groups 0.1." Any ideas on how well it works?

    Thanks!

  • peregrineperegrine MVP
    edited January 2014

    I think there is a bit of a flaw in the logic.

    what if you get what you want.

    What I would like is a discussion showing all posts-- by schoolA people, schoolB people, schoolC people, general member people, etc. Then, if I was interested in only seeing what the schoolA people posted (regardless if I have a schoolA role or not), I could somehow filter/select them out.

    lets say schoolA person posted a discussion topic
    schoolB posted a comment on that topic.

    what to do then?

    only show schoolA discussion to SchoolA users.
    or also show it to SchoolB users because it had a comment by schoolB users.
    then when SchoolC users posts a comment to SchoolA user then do you also
    show Discussion to SchoolC users.

    maybe what you need is the roletitle plugin. Assign members to a SchoolRole.

    than it is easily viewable which school initiated discussion, and you wouldn't have the morass of tags and all the underlying database additions.

    The you could filter by js based on role in discussion topics and hide that way.

    Each has its own problems.

    maybe just a hierarchy of categories is better viewable by all you would have duplicated categories. But performance would not be affected by all the gyrations. It would be filtered by picking category to view. And everyone could see all discussions by clicking on All discussions.
    Then you could color code discussions topics by school.

    General - common to all schools
       admin 
       staff
       geology
    
    SchoolA  - school A specific issues
       admin 
       staff
       geology
    
    SchoolB  - school B specific issues
        admin 
       staff
       geology
    
    SchoolC  - school C specific issues
      admin 
       staff
       geology
    

    maybe what you are looking for is a plugin that does this and someone to write it.

    http://vanillaforums.org/discussion/25812/category-viewing-thought

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thanks for your patience with me peregrine. I'm brand new to Vanilla!

    I was considering that category structure, but my plan is to ultimately have many schools. I think it would get too unwieldy.

    Playing around with this site, I can click on a category (i.e. "Questions"), then click on a tag (i.e. "Wordpress") and see just the Wordpress tagged posts in the Questions category. If there was some way to automatically tag all posts for each role (schoolA posts all tagged as "School A") I think I would have the solution.

    Do you know if there is any way to automatically tag posts by role?

  • peregrineperegrine MVP
    edited January 2014

    Do you know if there is any way to automatically tag posts by role?

    i suppose you could check for role of user and tag it via an event triggering on PostController.

    look at the code in the tagging plugins and roletitle plugins.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • add tag based on role for each discussion.

    pseudo code  - not tested and not complete - just to show you where to go as one possiblity.
    
         $Object = GetValue('Object', $Sender->EventArguments);
          $Roles = $Object ? GetValue('Roles', $Object, array()) : FALSE;
    
        if (in_array("SchoolA",$Roles)) {
    
          // update the $FormTags array with SchoolA
                 $FormTags =         
    
    
          // unique it again
            $FormTags = array_unique($FormTags);
    
    
     you could play around with above code in the tagging plugin
    
      public function DiscussionModel_AfterSaveDiscussion_Handler($Sender) {
    

    I don't want to write the code nor do I want to test it, but the above is an idea.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thanks. I'm not a coder, but I'll see what I can do.

Sign In or Register to comment.