function actions_do


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL)
cle7 actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL)
elmsmedia7 actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL)
icor7 actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL)
meedjum_blog7 actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL)
mooc7 actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL)

Performs a given list of actions by executing their callback functions.

Given the IDs of actions to perform, this function finds out what the callback functions for the actions are by querying the database. Then it calls each callback using the function call $function($object, $context, $a1, $a2), passing the input arguments of this function (see below) to the action function.


$action_ids: The IDs of the actions to perform. Can be a single action ID or an array of IDs. IDs of configurable actions must be given as numeric action IDs; IDs of non-configurable actions may be given as action function names.

$object: The object that the action will act on: a node, user, or comment object.

$context: Associative array containing extra information about what triggered the action call, with $context['hook'] giving the name of the hook that resulted in this call to actions_do().

$a1: Passed along to the callback.

$a2: Passed along to the callback.

Return value

An associative array containing the results of the functions that perform the actions, keyed on action ID.

Related topics

11 calls to actions_do()
actions_loop_test_watchdog in modules/simpletest/tests/actions_loop_test.module
Implements hook_watchdog().
hidden_nodes_scheduler_scheduler_api in sites/all/modules/elmsln_contrib/hidden_nodes/modules/hidden_nodes_scheduler/hidden_nodes_scheduler.module
Implements hook_scheduler_api().
job_scheduler_trigger_worker in sites/all/modules/ulmus/job_scheduler/modules/job_scheduler_trigger/job_scheduler_trigger.module
Fire up a scheduled trigger
trigger_cron in modules/trigger/trigger.module
Implements hook_cron().
ViewsBulkOperationsAction::execute in sites/all/modules/ulmus/views_bulk_operations/plugins/operation_types/action.class.php
Executes the selected operation on the provided data.

... See full list


includes/, line 58
This is the actions engine for executing stored actions.


function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL) {
  // $stack tracks the number of recursive calls.
  static $stack;
  if ($stack > variable_get('actions_max_stack', 35)) {
    watchdog('actions', 'Stack overflow: too many calls to actions_do(). Aborting to prevent infinite recursion.', array(), WATCHDOG_ERROR);
  $actions = array();
  $available_actions = actions_list();
  $actions_result = array();
  if (is_array($action_ids)) {
    $conditions = array();
    foreach ($action_ids as $action_id) {
      if (is_numeric($action_id)) {
        $conditions[] = $action_id;
      elseif (isset($available_actions[$action_id])) {
        $actions[$action_id] = $available_actions[$action_id];

    // When we have action instances we must go to the database to retrieve
    // instance data.
    if (!empty($conditions)) {
      $query = db_select('actions');
      $query->addField('actions', 'aid');
      $query->addField('actions', 'type');
      $query->addField('actions', 'callback');
      $query->addField('actions', 'parameters');
      $query->condition('aid', $conditions, 'IN');
      $result = $query->execute();
      foreach ($result as $action) {
        $actions[$action->aid] = $action->parameters ? unserialize($action->parameters) : array();
        $actions[$action->aid]['callback'] = $action->callback;
        $actions[$action->aid]['type'] = $action->type;

    // Fire actions, in no particular order.
    foreach ($actions as $action_id => $params) {
      // Configurable actions need parameters.
      if (is_numeric($action_id)) {
        $function = $params['callback'];
        if (function_exists($function)) {
          $context = array_merge($context, $params);
          $actions_result[$action_id] = $function($object, $context, $a1, $a2);
        else {
          $actions_result[$action_id] = FALSE;
      // Singleton action; $action_id is the function name.
      else {
        $actions_result[$action_id] = $action_id($object, $context, $a1, $a2);
  // Optimized execution of a single action.
  else {
    // If it's a configurable action, retrieve stored parameters.
    if (is_numeric($action_ids)) {
      $action = db_query("SELECT callback, parameters FROM {actions} WHERE aid = :aid", array(':aid' => $action_ids))->fetchObject();
      $function = $action->callback;
      if (function_exists($function)) {
        $context = array_merge($context, unserialize($action->parameters));
        $actions_result[$action_ids] = $function($object, $context, $a1, $a2);
      else {
        $actions_result[$action_ids] = FALSE;
    // Singleton action; $action_ids is the function name.
    else {
      if (function_exists($action_ids)) {
        $actions_result[$action_ids] = $action_ids($object, $context, $a1, $a2);
      else {
        // Set to avoid undefined index error messages later.
        $actions_result[$action_ids] = FALSE;
  return $actions_result;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.