You are here

function node_list_activity_actions in Activity 6.2

List all the Activity Actions that match the hook and op.

Parameters

string $hook: The hook that is to be fired.

string $op: The op to be used in the hook.

int $max_age: The max age from now.

Return value

array An array of arrays with 'id', 'created' and 'actor' keys.

1 string reference to 'node_list_activity_actions'
node_activity_info in ./activity.module

File

modules/node.activity.inc, line 86
Activity definition file for node.module

Code

function node_list_activity_actions($hook, $op, $max_age) {
  $actions = array();
  if (!empty($max_age)) {
    $min_time = time() - $max_age;
  }
  else {
    $min_time = 0;
  }
  if ($op == 'insert') {
    $sql = "SELECT nid as id, created as created, uid as actor FROM {node} WHERE created > %d";
  }
  elseif ($op == 'view') {
    $sql = "SELECT nid as id, timestamp as created, uid as actor FROM {history} WHERE timestamp > %d";
  }
  if (isset($sql)) {
    $result = db_query($sql, $min_time);
    while ($row = db_fetch_array($result)) {
      $actions[] = $row;
    }
  }
  return $actions;
}