You are here

function flag_rules_action_trim in Flag 7.3

Same name and namespace in other branches
  1. 6.2 includes/flag.rules.inc \flag_rules_action_trim()
  2. 6 includes/flag.rules.inc \flag_rules_action_trim()
  3. 7.2 flag.rules.inc \flag_rules_action_trim()

Base action implementation: Trim flag.

1 string reference to 'flag_rules_action_trim'
flag_rules_action_info in ./flag.rules.inc
Implements hook_rules_action_info().

File

./flag.rules.inc, line 402
Rules integration for the Flag module.

Code

function flag_rules_action_trim($flag, $flagging_user, $cutoff_size, $trim_newest, $permissions_check) {

  // For some reason, when this action fires in response to a flagging event,
  // as an anonymous user, then the $flagging_user is sent through as FALSE.
  // Not sure why. This workaround fixes the problem in this specific case.
  if ($flagging_user === FALSE) {
    $flagging_user = $GLOBALS['user'];
  }
  flag_trim_flag($flag, $flagging_user, $cutoff_size, $trim_newest, $permissions_check);
}