Installed module on latest D6 release. On a view page that listed nodes I received the following error:

notice: Undefined index: type in publishcontent/publishcontent.module on line 158.
notice: Undefined index: #value in in publishcontent/publishcontent.module on line 158.

I needed this working ASAP so I added the following code which seems to have resolved it:


Added the following to publishcontent.module, line 153:   

#Fix for Undefined index error
  if(!isset($form['type']) || !isset($form['type']['#value'])) {
    return FALSE;
  }

// Below is the full function with the code added.

/**
 * Implementation of hook_form_alter()
 *
 * allow to use the 'Publishing options' on the edit/add page
 */
function publishcontent_form_alter(&$form, $form_state, $form_id) {
  #Fix for Undefined index error
  if(!isset($form['type']) || !isset($form['type']['#value'])) {
    return FALSE;
  }
  if (!user_access('administer nodes')
      && $form['type']['#value'] .'_node_form' == $form_id
      && (_publishcontent_unpublish_access($form['#node']) ||
          _publishcontent_publish_access($form['#node']))) {
    $form['options']['#access'] = TRUE;
    unset($form['options']['promote']);
    unset($form['options']['sticky']);
    unset($form['options']['revision']);
  }
}

If others experience this bug, I would be happy to submit patch.

Comments

malaussene’s picture

Hi ngmaloney,

which form/url generate this notice?

ngmaloney’s picture

It was on any node edit page.

aaronbauman’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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