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.

Category Concern

So I plan to have a forum where some members will have access to category A and some will have access to A and B.

My concern is with the drop down allowing the user to choose which category they are posting. I'd rather have this disabled and default the post depending on which forum/board they are currently browsing. For example it would be an major issue if someone posting on forum B accidentally had a data spillage to forum A.

How can I do this?

Comments

  • I'm pretty sure Vanilla 2.1 auto-selects your current category when you click "New Discussion", no?

    Also, if you only have access to 1 or the other, you won't ever see the other as an option.

  • Yea I see it actually defaults now. But still the user can accidentally change it which would be detrimental.

  • Categories that users have no permission to post in will not be shown in the dropdown.
    It's always a good idea to test permissions for yourself with a user account.

  • edited September 2014

    But someone with access to both could accidentally post in the wrong forum. Might just need to mess with the PHP files.

  • @scottybweyy said:
    But someone with access to both could accidentally post in the wrong forum. Might just need to mess with the PHP files.

    What, exactly, would you do in the PHP files to prevent someone from clicking the wrong category and posting to it when they are explicitly given the option of doing so?

  • Remove the whole category drop down box entirely.

  • So if I want to post a discussion in Category A I first have to go to www.example.com/categories/a and then click on [New Discussion] there? That is really not user friendly. Wouldn't some strong visual feedback be better?

  • I don't think I'm really explaining this well. I have some users with only access to forum A. I have some users with only access to forum B. I have some users with access forum A and forum B.

    Here is what I'm trying to avoid. When you go to my forum home page when logged in as a user who has access for forum A and forum B you see both forums listed. You click on forum A to see the threads. Then there is the new discussion button. The user clicks the new discussion button.

    This user types up a thread and accidentally changes the drop down category from forum A to forum B and posts it. Now forum B users see data they should have never seen. If I could disable the drop down box I would prevent this from happening as easily.

  • Just do it with CSS

    #DiscussionForm div.Category {display: none;}
    

    @R_J is right though, it's not very user friendly
    You could also add a message this way:

    #DiscussionForm div.Category:after {
        color: red;
        font-weight: bold;
        content: "Do not change this, please!"
    }
    

    :joy:

  • @Bleistivt‌ - Assuming I should add the CSS in my custom.css right?

  • Yes, if you want to hide it completely, put the first bit in your custom.css

    Beware that the "New Discussion" button in the category and discussions overview will be useless as there is no way to select a category then.

  • x00x00 MVP
    edited September 2014

    edit sorry gotcha

    grep is your friend.

  • Awesome that worked thank you!

    Can I disable the "New Discussion" button as well on both those overview pages?

  • that would be:

    #vanilla_discussions_index .BoxNewDiscussion,
    .Section-CategoryList .BoxNewDiscussion {
        display: none;
    }
    
  • Thank you so much for all your help. So I can try and learn more in the future, is there a guide where are all the elements defined?

  • x00x00 MVP
    edited September 2014

    how about class.scottythemehooks.php

    <?php if (!defined('APPLICATION')) exit();
    class ScottyThemeHooks extends Gdn_Plugin{
        public function PostController_BeforeFormInputs_Hander($Sender){
            if(GetValue('CategoryID', $Sender->Category) > 0){
                 $Sender->ShowCategorySelector = FALSE;
                 $Sender->Form->AddHidden('CategoryID', GetValue('CategoryID', $Sender->Category));
                 echo $Sender->Form->Hidden('CategoryID', array('value' => GetValue('CategoryID', $Sender->Category))); 
    
            }
        }
    }
    

    place it in your theme folder

    grep is your friend.

Sign In or Register to comment.