Community Documentation

Allow users with a certain role to post without moderation

Last updated March 31, 2009. Created by raintonr on June 21, 2007.
Edited by VM. Log in to edit this page.

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.

About this page

Drupal version
Drupal 5.x

Reference

Drupal’s online documentation is © 2000-2012 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.
nobody click here