Quote:
Originally Posted by omardealo
(Post 2502631)
Hello ,
i need php condition " if user is moderator "
In other words, I want Run Code only if is this user is a moderator
Like :
PHP Code:
if (userid == can_moderate) { // my code }
|
There is a function called can_moderate:
Code:
/**
* 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 = '')
{
So for example if you wanted to know if userid has *any* moderator permissions, it would be
Code:
if (can_moderate(0, '', $userid))
{
// code
}
But just so you know, it does do database queries for the info it needs, depending on exactly what parameters you pass to it.
|