Please upgrade here. These earlier versions are no longer being updated and have security issues.

how to modify the button "start a new discussion" function?

huahua
edited May 2011 in Vanilla 2.0 - 2.8
The file called "newdiscussion.php" under the path "applications/vanilla/views/modules" , its code is
<?php if (!defined('APPLICATION')) exit();
echo Anchor(T('Start a New Discussion'), '/post/discussion'.(array_key_exists('CategoryID', $Data) ? '/'.$Data['CategoryID'] : ''), 'BigButton NewDiscussion');</pre>

and I added some code into it.

<?php if (!defined('APPLICATION')) exit();
if ($Session->CheckPermission('Vanilla.Discussions.Add', TRUE, 'Category', $Discussion->PermissionCategoryID))
echo Anchor(T('Start a New Discussion'), '/post/discussion'.(array_key_exists('CategoryID', $Data) ? '/'.$Data['CategoryID'] : ''), 'BigButton NewDiscussion');
for the reason ,i want to the member can see the start button if he has the role permission, the member can not if he has no the role permission.

but now it tells me error

Fatal error: Call to a member function CheckPermission() on a non-object in /applications/vanilla/views/modules/newdiscussion.php on line 2

so what is the right way to do is? can anybody tell me? thanks
Tagged:

Comments

  • I agree, I would like the same feature!
    it would be nice to change the tittle of this discussion to a question... like: "how to...?" etc
  • i review the code again,and i think use this code is right

    if ($Session->CheckPermission('Vanilla.Discussions.Add', TRUE, 'Category', $Discussion->PermissionCategoryID))

    but it still shows error ,so who can help me? thanks
Sign In or Register to comment.