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.

Hiding the "Start a New Discussion" button

edited June 2010 in Vanilla 2.0 - 2.8
How can I hide the "Start a New Discussion" button in the sidebar panel for people who don't have permissions to start a new discussion? Right now it's visible and is causing confusion when a user clicks on it and gets a permission denied error. Thanks!

Comments

  • oliverraduneroliverraduner ✭✭
    edited June 2010
    @coolgates Copy the following View to your template's /views/ folder:
    /applications/vanilla/views/modules/newdiscussion.php
    Then edit the file and add a check for the user permissions, before the Anchor() is echoed.
  • Thanks. That makes sense. I'm almost a complete dummy when it comes to PHP - is there an example in another file for how to check user permissions? This stuff would be great to have in the documentation.
  • oliverraduneroliverraduner ✭✭
    edited June 2010
    @coolgates I cannot test this, but I think you need to add above the echo-code in "newdiscussion.php" to the following:
    if ($Session->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID))
    echo Anchor(T('Start a New Discussion'), '/post/discussion'.(array_key_exists('CategoryID', $Data) ? '/'.$Data['CategoryID'] : ''), 'BigButton NewDiscussion');
  • Wouldn't a better plan be to be NOT to hide it, but just route you to the register/sign in page?
  • nope
    we had the same issue too
    we have a read-only members(females) on our forum(private one), and needed to hide post comment form and new discussion button for users under their role
Sign In or Register to comment.