Kind of an odd bug that took me awhile to track down. When the workflow state of a node that uses nodecomments is changed, the commenting settings will change from the default of 'read/write' to "disabled".

I was able to reproduce this bug on a bare installation. Steps for reproducing are below:

  1. Install Drupal (I'm using 6.16)
  2. Install workflow, nodecomment modules (i'm using workflow 6.x-1.4 and nodecomments 6.x-2.0-beta3
  3. Set up a new workflow with two states, I used 'waiting' and 'published'. Make sure users have permission to access the workflow tab
  4. Make the a node type use nodecomments, defaulting to 'read/write', and make sure this node type uses the workflow you've created
  5. Create a new node of said type. After creation, go to the workflow tab (editing workflow settings under "edit" will not result in this bug), change the workflow state. Upon submitting, commenting will no longer be enabled.

Although changing settings under editing will not cause this bug, any scheduled state changes or changes via actions will.

If I can provide any assistance or more information please let me know

CommentFileSizeAuthor
#6 nodecomment_737570.patch560 bytescrea
#2 nodecomment.module.patch533 bytesmelsawy

Comments

melsawy’s picture

subscribe

melsawy’s picture

StatusFileSize
new533 bytes

On hook_noadapi case load If it's a node comment type the node->comment will disable and workflow tab changing status used node_save so the comments will be disabled .
I fixed it by comment this line.

crea’s picture

Status: Active » Needs review

Setting proper status.

vood002’s picture

Status: Needs review » Needs work

I applied this patch, and although it fixed the workflow-state-change problem I referenced in this thread, it also caused all nodecomments to stop showing up on their parent node page.

crea’s picture

Yes this is probably bad mechanics: any module could save modified node breaking the setting.

crea’s picture

Status: Needs work » Needs review
StatusFileSize
new560 bytes

Please try this.

crea’s picture

Title: Updating workflow state sets a node's commenting settings to 'disabled' » Saving a node with node comments sets the node's commenting settings to 'disabled'
crea’s picture

Title: Saving a node with node comments sets the node's commenting settings to 'disabled' » Node_save() of a node with node comments sets the node's commenting settings to 'disabled'

Changing title to reflect that it's programmatic save, not a user edit.

vood002’s picture

Status: Needs review » Reviewed & tested by the community

I've installed the patch from #6 and after two days of testing it's been working great. Thanks for the support Crea! I'm changing status to reviewed & tested.

Narretz’s picture

I am not very familiar with the workflow module, but enabled it to get to know it and test the patch. Something strange happened though.
I can confirm accessing the workflow tab does not reset the comment settings anymore, but afterwards I could not change the settings manually. The changes simply are not applied, even though I get the "Story Test Story 2 has been updated." message, and no errors.
I disabled the workflow module, but I still cannot change the settings, so that leads me to believe it's caused by the patch only.

Narretz’s picture

Something similar happened when I enabled "synchronize translations" on a node type with node comments.
Steps to reproduce:

- Have at least two languages defined
- enable a synchronize translations setting (I used taxonomy terms)
- create a node (nodecomments enabled)
- translate the node

in the source, the comment settings are set to disabled. Enable them, and the node's translation now has its comments disabled.

crea’s picture

@Narretz your report seems to be unrelated. This patch only restores node comment setting. The code simply fixes the opposite operation during "load" operation of nodeapi:

      else if ($node->comment_type) {
        // It's not a comment, so check its comment status.
        // Check the comment type for this node. If it's a node comment type, move $node->comment to
        // $node->node_comment and set $node->comment to disabled.
        $node->node_comment = $node->comment;
        $node->comment = COMMENT_NODE_DISABLED;
      }

I'm going to commit this, cause the bug is fairly critical. If it brings some incompatibility, let's fix it in a separate issue.

crea’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

crea’s picture

Could you please help test the patch in #848598: Nodecomments doesn't track changes to the node comment setting so that we don't break this bugfix ?

kenorb’s picture

Note: For Drupal 7 use: COMMENT_NODE_HIDDEN constant