You are here

function antispam_is_spam_moderator in AntiSpam 7

Same name and namespace in other branches
  1. 6 antispam.module \antispam_is_spam_moderator()

Is current user spam moderator?

Parameters

string $moderator_type: Moderator Type - comments, node type or NULL.

object $account: The user account to check; use current user if not given.

Return value

boolean TRUE if current user is moderator of specified type; FALSE otherwise.

5 calls to antispam_is_spam_moderator()
antispam_access_callback in ./antispam.module
antispam_comment_view in ./antispam.module
Implements hook_comment_view().
antispam_node_view in ./antispam.module
Implements hook_node_view().
_antispam_comment_save in ./antispam.module
Called from hook_comment_insert() and hook_comment_update().
_antispam_node_save in ./antispam.module
Called from hook_node_insert() and hook_node_update()

File

./antispam.module, line 1308
Primary hook implementations for the Antispam module.

Code

function antispam_is_spam_moderator($moderator_type = NULL, $account = NULL) {
  global $user;
  if (is_null($account)) {
    $account = $user;
  }
  $moderator_types = antispam_get_moderator_types($account);
  if (is_null($moderator_type)) {
    return count($moderator_types) > 0 ? TRUE : FALSE;
  }
  return isset($moderator_types[$moderator_type]);
}