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

johngriffin’s picture

Assigned: Unassigned » johngriffin
johngriffin’s picture

You're absolutely right. This should be fixed in 6.x-1.0-beta2 - please let me know if it works for you?

tom_o_t’s picture

Version: 6.x-1.0-beta1 » 6.x-1.0-beta2
Status: Needs review » Reviewed & tested by the community

Fixed in beta2, works perfectly. Great work!

johngriffin’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.