diff options
-rw-r--r-- | includes/actions.inc | 10 | ||||
-rw-r--r-- | modules/trigger/trigger.module | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/includes/actions.inc b/includes/actions.inc index 008410fb4..ac79a7c15 100644 --- a/includes/actions.inc +++ b/includes/actions.inc @@ -11,11 +11,9 @@ * * Given the IDs of actions to perform, find out what the callbacks * for the actions are by querying the database. Then call each callback - * using the function call $function('do', $object, $context, $a1, $2) + * using the function call $function($object, $context, $a1, $2) * where $function is the name of a function written in compliance with - * the action specification; that is, foo($object, $context). The $params - * parameter is an array of stored parameters that have been previously - * configured through the web using actions.module. + * the action specification; that is, foo($object, $context). * * @param $action_ids * The ID of the action to perform. Can be a single action ID or an array @@ -24,6 +22,8 @@ * @param $object * Parameter that will be passed along to the callback. Typically the * object that the action will act on; a node, user or comment object. + * If the action does not act on an object, pass a dummy object. This + * is necessary to support PHP 4 object referencing. * @param $context * Parameter that will be passed along to the callback. $context is a * keyed array containing extra information about what is currently @@ -39,7 +39,7 @@ * An associative array containing the result of the function that * performs the action, keyed on action ID. */ -function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL) { +function actions_do($action_ids, &$object, $context = NULL, $a1 = NULL, $a2 = NULL) { static $stack; $stack++; if ($stack > variable_get('actions_max_stack', 35)) { diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module index 283f9a148..c14fb8e9c 100644 --- a/modules/trigger/trigger.module +++ b/modules/trigger/trigger.module @@ -206,7 +206,7 @@ function _trigger_normalize_node_context($type, $node) { /** * Implementation of hook_nodeapi(). */ -function trigger_nodeapi($node, $op, $a3, $a4) { +function trigger_nodeapi(&$node, $op, $a3, $a4) { // Keep objects for reuse so that changes actions make to objects can persist. static $objects; // Prevent recursion by tracking which operations have already been called. @@ -299,7 +299,8 @@ function trigger_comment($a1, $op) { actions_do($aid, $objects[$action_info['type']], $context); } else { - actions_do($aid, (object) $a1, $context); + $comment = (object) $a1; + actions_do($aid, $comment, $context); } } } @@ -392,7 +393,8 @@ function trigger_taxonomy($op, $type, $array) { 'op' => $op ); foreach ($aids as $aid => $action_info) { - actions_do($aid, (object) $array, $context); + $taxonomy_object = (object) $array; + actions_do($aid, $taxonomy_object, $context); } } |