PDA

View Full Version : How do I Check Mod Permission via Plugin


zhai
07-23-2012, 03:21 AM
I want to use something similar with "can_moderate" that is available in templates conditionals.
How do I perform such operation inside a plugin?

Say that I have an array of forum IDs and a Userid. I want to iterate all the way through my array of Forum IDs to check if the User has any moderation power in any of those forum IDs. What function should I use?

thanks

kh99
07-23-2012, 05:57 AM
You can call can_moderate() in a plugin - it's in includes/functions.php around line 6567:


/**
* Returns whether or not the given user can perform a specific moderation action in the specified forum
*
* @param integer Forum ID
* @param string If you want to check a particular moderation permission, name it here
* @param integer User ID
* @param string Comma separated list of usergroups to which the user belongs
*
* @return boolean
*/
function can_moderate($forumid = 0, $do = '', $userid = -1, $usergroupids = '')