1. 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

Discussion in 'XenForo Development Discussions' started by James, Jan 20, 2012.

  1. James

    James Well-Known Member

    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?
  2. Syndol

    Syndol Guest

    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 and anonymous like this.
  3. James

    James Well-Known Member

    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.

Share This Page