mediatribe.net -- Drupal and Web Development

Notice: this post was last updated 6 years 27 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

Creating actions for use with views bulk operations

You can combine Views bulk operations with your own code to make powerful actions which can be applied to several nodes at the time.

Here is some sample code to create an action:

  /* describe your action(s) */
function mymodule_action_info() {
  return array(
    'mymodule_action_callback' => array(
       'type' => 'node',
       'description' => t('My action description.'),
       'configurable' => FALSE,
      )
    );
}

function mymodule_action_callback(&$node, $context) {
 
  /* do something with your node here */

  node_save($node);
}

This works for Drupal 6.0 -

This works for Drupal 6.0 - thanks.