Closed (fixed)
Project:
Moderate Bypass
Version:
6.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
4 Nov 2009 at 02:03 UTC
Updated:
29 Nov 2009 at 14:10 UTC
In the code you have in beta1, it appears as though you must hide the "in moderation queue" checkbox before it branches in and checks for whether or not to publish by default. My understanding form the screen is that you should be able to check each of the options independently. Not sure if my understanding is wrong, or the code is wrong, but I changed the compound conditional to be two distinct checks (as long as they have permission to bypass).
My code looks like this:
/**
* Implementation of hook_nodeapi().
*
* If the requisite options are set then remove the moderation checkbox
* and set published as default on node add forms
*/
function modr8_bypass_form_alter(&$form, $form_state, $form_id) {
if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) {
// If they have permission to bypass, let's check the other options
if (user_access('bypass '. $form['type']['#value'] .' moderation')) {
// first, should we remove the checkbox for "in moderation queue" altogether?
if (variable_get('modr8_bypass_suppress', FALSE)) {
if (user_access('administer nodes')) {
unset($form['options']['moderate']);
}
elseif (user_access('moderate content')) {
unset($form['moderate']);
}
}
// do they want to set to publish by default?
if (variable_get('modr8_bypass_publish', FALSE)) {
$form['options']['status']['#default_value'] = 1;
}
}
}
}
I can roll this into a patch if it's easier for you, but maybe it's just as easy to paste this code over the existing function. :)
Comments
Comment #1
johngriffin commentedComment #2
johngriffin commentedYou're absolutely right. This should be fixed in 6.x-1.0-beta2 - please let me know if it works for you?
Comment #3
tom_o_t commentedFixed in beta2, works perfectly. Great work!
Comment #4
johngriffin commented