Allow users with a certain role to post without moderation
Last modified: March 31, 2009 - 02:54
Drupal 5.x version of: http://drupal.org/node/113696
Using the 4.x code from the link above I created a mini module and decided to name it 'moderation_skip'. Perhaps a more accurate name would be 'auto-publish' or something like that, but you get the idea.
1. Create a directory under modules named moderation_skip.
2. Put the following in moderation_skip.module:
<?php
/**
* Implementation of hook_perm().
*/
function moderation_skip_perm() {
return array('skip node moderation');
}
/**
* Implementation of hook_nodeapi()
*
* Set the moderation state of a node
*/
function moderation_skip_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
switch ($op) {
case 'submit':
if ($node->status != 1 && user_access('skip node moderation')) {
if (!user_access('administer nodes')) { // Don't reset for admins
$node->status = 1; // Publish the node.
$node->moderate = 0;
}
}
break;
}
}
?>3. Put the following in moderation_skip.info:
name = Moderation skip
description = "Allow users with certain roles to bypass node moderation."
version = "5.x-0.1"4. Visit modules admin page and enable the new module.
5. Visit role permissions and grant the 'skip node moderation' permission to any roles required.
