I have a lot of contribute modules, and I don't know how, but form['#node'] is set up in the comment form as well. As a result, the workflow form field shows up in my comment form even though the settings clearly say that they are for the node form only (of a particular content type).
I fixed this issue by changing the module form_alter function

function workflow_form_alter(&$form, $form_state, $form_id) {
  // Ignore all forms except comment forms and node editing forms.
  if ($form_id == 'comment_form' || (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id)) {
    if (isset($form['#node'])) {
      $node = $form['#node'];
      // Abort if no workflow is assigned to this node type.
      if (!in_array('node', variable_get('workflow_' . $node->type, array('node')))) {
        return;
      }
    }

to

function workflow_form_alter(&$form, $form_state, $form_id) {
  // Ignore all forms except comment forms and node editing forms.
  if ($form_id == 'comment_form' || (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id)) {
    //if (isset($form['#node'])) {
    if ($form_id != 'comment_form') {
      $node = $form['#node'];
      // Abort if no workflow is assigned to this node type.
      if (!in_array('node', variable_get('workflow_' . $node->type, array('node')))) {
        return;
      }
    }

In the form_alter_hook of module, why do we do a chk on
if (isset($form['#node']))
and not
if ($form_id != 'comment_form') ??

thanks

Comments

kpv’s picture

+1 for D7

johnv’s picture

Title: Workflow form showing up in comments even though the variables are set correctly » Workflow form showing up in comments even though the variables are set correctly (D6)
Issue summary: View changes

This should be fixed in 7.x-2.x, so leaving it open for D6. (which is not maintained ATM)

johnv’s picture

Status: Active » Closed (won't fix)

I wish there was a nicer way to clear the issue queue from 'D6-issues that are fixed in D7' then a "won't fix for D6."