MyBB Community Forums
Is there an equivalent to cancp for moderators? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: Is there an equivalent to cancp for moderators? (/thread-207456.html)



Is there an equivalent to cancp for moderators? - ConnerKid - 2017-01-15

I know you can do $mybb->user['cancp'] to see if is a user is an admin, but is there anything equivalent for forum moderators?


RE: Is there an equivalent to cancp for moderators? - Matt - 2017-01-15

is_moderator(), or is_moderator($fid) to check a specific forum.


RE: Is there an equivalent to cancp for moderators? - ConnerKid - 2017-01-15

(2017-01-15, 07:26 PM)Matt Wrote: is_moderator(), or is_moderator($fid) to check a specific forum.

Can you give me an example of calling this? Sorry if this is a dumb question.


RE: Is there an equivalent to cancp for moderators? - SvePu - 2017-01-15

==> http://phpcrossref.com/xref/mybb/inc/functions.php.html#l1527

Example:
if(!is_moderator($fid, "canmanagethreads"))
{
     error_no_permission();
}



RE: Is there an equivalent to cancp for moderators? - ConnerKid - 2017-01-15

(2017-01-15, 08:46 PM)SvePu Wrote: ==> http://phpcrossref.com/xref/mybb/inc/functions.php.html#l1527

Example:
if(!is_moderator($fid, "canmanagethreads"))
{
     error_no_permission();
}

Thank you! I was looking in user functions.


RE: Is there an equivalent to cancp for moderators? - dragonexpert - 2017-01-16

(2017-01-15, 07:12 PM)ConnerKid Wrote: I know you can do $mybb->user['cancp'] to see if is a user is an admin, but is there anything equivalent for forum moderators?


In your example it should be $mybb->usergroup['cancp'].  Anytime you want to check if a user has a certain permission you use $mybb->usergroup['permission_name'].