• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Function to Check if User is Moderator of Current Forum

James

Well-known member
#1
I'm looking for a function to check whether the user who has posted (not visitor) is a moderator of the current forum that the post is in.

I've tried XenForo_Model_Moderator::getContentModerator(array(
'user_id' => $user['user_id'],
'content' => array('', $thread['node_id'])
)
however, that returns false unless the user is explicitly a moderator of that forum (i.e. if the user is a moderator of the parent node, it won't show them as a moderator for this forum ID).

Simple question: Is there a built-in XF function that checks if a user is a moderator of the current forum, taking permission inheritance into account?
 
S

Syndol

Guest
#2
Unless I miss understood you, a check such as the one in function canMoveThread in Model/Thread.php should do the trick.
It checks for the manageAnyThread permission for a specific node.
 

James

Well-known member
#3
Yeah I considered just checking for a specific moderator permission. I just thought I'd check if there was a function I missed that checked whether the user was a content moderator of a specific forum. I'll take the permission route, thanks Syndol.