diff -up modr8-5.x-2.4/modr8.module modr8/modr8.module --- modr8-5.x-2.4/modr8.module 2008-04-08 19:05:35.000000000 -0700 +++ modr8/modr8.module 2008-10-23 16:07:00.000000000 -0700 @@ -2,6 +2,11 @@ // $Id: modr8.module,v 1.5.2.15 2008/04/09 02:05:35 pwolanin Exp $ /** + * HACK: This module has been altered by Jason Arnold to + * provide a 'bypass content moderation' capability that may be granted to arbitrary roles + */ + +/** * @file * Easy dedicated content moderation */ @@ -66,7 +71,14 @@ function modr8_menu($may_cache) { * Implementation of hook_perm(). */ function modr8_perm() { - return array('moderate content'); + + $perms = array(); + foreach (node_get_types('types') as $n) { + $perms[] = 'bypass ' . $n->name . ' moderation'; + } + + $perms[] = 'moderate content'; + return $perms; } /** @@ -114,6 +126,9 @@ function modr8_settings() { */ function modr8_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { // add messages here.. + + global $user; + switch ($op) { case 'load': return db_fetch_array(db_query('SELECT n.moderate FROM {node} n WHERE n.nid = %d', $node->nid)); @@ -133,7 +148,11 @@ function modr8_nodeapi(&$node, $op, $tea break; case 'update' : case 'insert' : - db_query('UPDATE {node} SET moderate = %d WHERE nid = %d', $node->moderate, $node->nid); + $typename = node_get_types('name', $node->type); + if (user_access('bypass ' . $typename . ' moderation') && $node->uid == $user->uid) { + $node->moderate = 0; + } + db_query('UPDATE {node} SET moderate = %d WHERE nid = %d', $node->moderate, $node->nid); if ($node->moderate) { //cut this? theme('modr8_message', FALSE, $node->type, $op); } @@ -160,7 +179,10 @@ function modr8_form_alter($form_id, &$fo '#weight' => 24, '#description' => t('This %type will be placed in moderation if the %moderate checkbox is selected.', array('%type' => node_get_types('name', $form['#node']), '%moderate' => t('In moderation queue'))), ); - if (user_access('administer nodes')) { + + $typename = node_get_types('name', $form['type']['#value']); + + if (user_access('administer nodes') || (user_access('bypass ' . $typename . ' moderation'))) { $form['options']['moderate'] = $moderate_checkbox; } elseif (user_access('moderate content')) { diff -up modr8-5.x-2.4/modr8_admin.inc modr8/modr8_admin.inc --- modr8-5.x-2.4/modr8_admin.inc 2008-04-14 16:58:13.000000000 -0700 +++ modr8/modr8_admin.inc 2008-10-21 22:41:00.000000000 -0700 @@ -105,6 +105,13 @@ function modr8_settings_form() { '#default_value' => variable_get('modr8_noact_text', $noact_default), '#description' => t('Replacement strings are: %macros', array('%macros' => $macros)), ); + + + $nodetypes = array(); + foreach(node_get_types('types') as $t) { + $nodetypes[$t->type] = t($t->name); + } + $form['#validate'] = array('modr8_settings_validate' => array()); return system_settings_form($form);