Lack of interest Show Actionbuttons even if user have no permission

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

xf_phantom

Well-known member
Sometimes, it would be really usefull, if i could show "post a new thread", "start a new conversation" and the "post reply" button, even if the user have no permission, just to be able to show him custom error messages, e.g. that he would be able to do this, if he would join the premium usergroup.

The accentuation is on "SOMETIMES" ;) If i don't sell premiumaccounts or anything else, i don't care if they see the buttons or not, then i would even prefer to hide it
Maybe as option?!
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
Just an idea without any big code changes, without new methods and without backward incompability :)

Rich (BB code):
public function canPostThreadInForum(array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null, $for=null)
   {
     $this->standardizeViewingUserReferenceForNode($forum['node_id'], $viewingUser, $nodePermissions);

     if (empty($forum['allow_posting']))
     {
       $errorPhraseKey = 'you_may_not_perform_this_action_because_forum_does_not_allow_posting';
       return false;
     }

     return XenForo_Permission::hasContentPermission($nodePermissions, 'postThread');
   }

controller:
Rich (BB code):
'canPostThread' => $forumModel->canPostThreadInForum($forum,'',null,null,'createThreadButton'),


Code:
My_Model extends XFCP_My_Model{
public function canPostThreadInForum(array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null, $for=null)
   {
    if (isset($for) && $for == 'createThreadButton')

{
return true;
}
return parent::canPostThreadInForum............
}


ATM I would have to use the registry or $GLOBALS, set the value in the controller, test in the model if it's set, but it could couse conflicts between addons from different coders, because of the different methods.
This would be much easier with an "official" extraparameter
 
Back
Top Bottom