? modr8-actions-310723-2.patch Index: modr8.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/modr8/modr8.module,v retrieving revision 1.21 diff -u -p -r1.21 modr8.module --- modr8.module 5 Sep 2008 00:45:50 -0000 1.21 +++ modr8.module 21 Sep 2008 19:23:33 -0000 @@ -74,6 +74,49 @@ function modr8_menu() { } /** + * Implementation of hook_action_info(). + */ +function modr8_action_info() { + return array( + 'modr8_node_moderate_action' => array( + 'type' => 'node', + 'description' => t('Put post into moderation queue'), + 'configurable' => FALSE, + 'behavior' => array('changes_node_property'), + 'hooks' => array( + 'nodeapi' => array('presave'), + ), + ), + 'modr8_node_approve_action' => array( + 'type' => 'node', + 'description' => t('Approve post (remove from moderation queue)'), + 'configurable' => FALSE, + 'behavior' => array('changes_node_property'), + 'hooks' => array( + 'nodeapi' => array('presave'), + ), + ), + ); +} + +/** + * Implementation of a Drupal action. Sets node->moderate to 1, meaning in moderation. + */ +function modr8_node_moderate_action(&$node, $context = array()) { + $node->moderate = 1; + watchdog('action', 'Set @type %title to in moderation.', array('@type' => node_get_types('name', $node), '%title' => $node->title)); +} + +/** + * Implementation of a Drupal action. Sets node->moderate to 0, meaning approved. + */ +function modr8_node_approve_action(&$node, $context = array()) { + $node->moderate = 0; + watchdog('action', 'Set @type %title to approved (not in moderation).', array('@type' => node_get_types('name', $node), '%title' => $node->title)); +} + + +/** * Implementation of hook_perm(). */ function modr8_perm() {