Module snippets: Actions

Last modified: September 6, 2009 - 02:02

The Actions.module is a powerful way to automate tasks on your website. Actions are small "snippets" of php code that can be triggered on certain events. For an example of a module that uses actions, see workflow.module.

To use these actions, create a custom module in modules directory and paste the actions snippet into your module.

Example

<?php
//This is my module

function action_do_something($op, $edit = array(), $node) {
/* ACTION SNIPPET CODE GOES HERE */
}
?>

Caution: Drupal 5.x: invoke actions_synchronize too

To get your custom action into the actions_registry table in Drupal 5, you also need to call actions_synchronize() in your module's implementation of hook_install (or hook_update()) for example: http://drupal.org/node/212378

 
 

Drupal is a registered trademark of Dries Buytaert.