You are here

function flag_rules_action_fetch_entity_by_user in Flag 7.2

Same name and namespace in other branches
  1. 7.3 flag.rules.inc \flag_rules_action_fetch_entity_by_user()

Base action implementation: Fetch entities who were flagged a user.

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

File

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

Code

function flag_rules_action_fetch_entity_by_user($flag, $user) {
  $result = db_select('flag_content', 'fc')
    ->fields('fc', array(
    'content_id',
  ))
    ->condition('content_type', $flag->content_type)
    ->condition('uid', $user->uid)
    ->condition('fid', $flag->fid)
    ->execute();
  $flagged = $result
    ->fetchCol();
  return array(
    'content_flagged_by_user' => $flagged,
  );
}