You are here

public function ActivityActionHandler::valid in Activity 7

Determine if the current Action is valid for this object.

Parameters

$eid: The entity id for the activity.

$actor: The uid of the actor for this activity.

$timestamp: Unix timestamp when this activity occurred.

array $objects: The collection of objects for this action.

mixed $argument1: The first argument passed to the action callback.

mixed $argument2: The second argument passed to the action callback.

Return value

boolean

2 calls to ActivityActionHandler::valid()
NodeActivityActionHandler::valid in ./activity_action_handlers.inc
Determine if the current Action is valid for this object.
UserActivityActionHandler::valid in ./activity_action_handlers.inc
Determine if the current Action is valid for this object.
2 methods override ActivityActionHandler::valid()
NodeActivityActionHandler::valid in ./activity_action_handlers.inc
Determine if the current Action is valid for this object.
UserActivityActionHandler::valid in ./activity_action_handlers.inc
Determine if the current Action is valid for this object.

File

./activity_action_handlers.inc, line 137

Class

ActivityActionHandler

Code

public function valid($eid, $actor, $timestamp, $objects, $argument1, $argument2) {
  if (!empty($this->options['window'])) {
    $count = db_select('activity', 'a')
      ->fields('a', array(
      'aid',
    ))
      ->condition('eid', $eid, '=')
      ->condition('uid', $actor, '=')
      ->condition('created', $timestamp - $this->options['window'], '>')
      ->condition('actions_id', $this->actions_id, '=')
      ->countQuery()
      ->execute()
      ->fetchField();
    return $count == 0;
  }
  return TRUE;
}