function flag_abuse_flag in Flag Abuse 6.2
Same name and namespace in other branches
- 6 flag_abuse.module \flag_abuse_flag()
Implementation of hook_flag().
If a user with appropriate permission/role flags this content from our view we want to remove all flags. http://drupal.org/node/327901#comment-1085685
@todo: When $flag->access() goes in, use this to limit access to a flag that an administrator has already acted upon. http://drupal.org/node/322034
File
- ./
flag_abuse.module, line 62
Code
function flag_abuse_flag($event, $flag, $content_id, $account) {
// permmission check instead of a role
if (user_access('reset abuse flags', $account)) {
// is this one of our abuse flags
// @todo: should be dynamic
if (in_array($flag->name, array(
'abuse_node',
'abuse_comment',
'abuse_user',
))) {
// remove all flags on this content
$rows = flag_reset_flag($flag, $content_id);
if ($rows) {
// This user actually flags the content as well, so it may confuse the
// user if they reset what they thought was one flag and we report two.
$rows--;
drupal_set_message(t('Reset !rows flags.', array(
'!rows' => $rows,
)));
variable_set($flag->name . '-' . $content_id, TRUE);
}
}
}
}