You are here

function flag_abuse_preprocess_flag in Flag Abuse 6

Same name and namespace in other branches
  1. 6.2 flag_abuse.module \flag_abuse_preprocess_flag()

Implementation of hook_preprocess_flag().

Here we change our flag event/action to 'reset'.

File

./flag_abuse.module, line 38

Code

function flag_abuse_preprocess_flag(&$vars) {
  global $user;

  // permmission check instead of a role
  if (user_access('reset abuse flags', $user)) {

    // is this one of our abuse flags
    // @todo: should be dynamic
    if (in_array($vars['flag']->name, array(
      'abuse_node',
      'abuse_comment',
      'abuse_user',
    ))) {
      $vars['action'] = 'reset';
      $vars['link_text'] = t('Reset flags');
      $vars['link_title'] = t('Remove all flags on this content');
    }
  }
}