Community Documentation

ARCHIVE: Module snippets: Actions

Last updated October 2, 2011. Created by mfredrickson on February 9, 2006.
Edited by JuliaKM, bekasu, bryan kennedy, sepeck. Log in to edit this page.

This information is out-of-date. See http://drupal.org/node/172152 instead.

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

Page status

About this page

Drupal version
Drupal 5.x

Archive

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here