I have the same problem as some others in other issues already stated : Disqus seems to work fine first, but then nodes start to disappear ( the disqus block is not showing up anymore and the comments are not shown in the "latest comments" blocks anymore )

After a bit of research i'm pretty certain that there is something wrong on the nodeapi hook.

Here is what i what i observed

-> I start with an empty disqus table in the database
-> I have disqus enabled on contenttypes and the comments show up fine on the pages
-> My cron runs and updates some of my nodes with unrelated new data
-> Now all those nodes are in the disqus table with status 0 ( disabled )
-> The disqus comments are not showing on those nodes anymore and when i edit the nodes, the "enable disqus comments" box is unchecked

-> TRUNCATE on the disqus table and everything is back to normal again

I'm not 100% sure where exactly the error lies, but i suspect that either the "unset($node->disqus_status);" on the validate case of the nodeapi hook or something in the update case is wrong and unsetting/ignoring the checkbox.

Members fund testing for the Drupal project. Drupal Association Learn more


jonathanpglick’s picture

Status: Active » Needs review
1.81 KB

I think there are two issues here:

  1. In the 'update' op, the status is being written from $node->disqus_status, which is only present if the update is running after the node was edited via a form. Any programmatic updates (I encountered problems with Flags) mean that the comments get disabled since $node->disqus_status isn't set anywhere.
  2. The disqus checkbox inserted into the node form isn't constructed to mirror the structure of the $node->disqus array.

The attached patch makes the following changes:

  • Changes the structure of the inserted checkbox to match the $node->disqus array.
  • 'insert' and 'update' ops updated to get 'status' value from $node->disqus['status'] rather than $node->disqus_status. This will then use the values either set in the nodeapi load op or from the node form.
  • Removes 'validate' op. This was being used to assign values, not for validation. The value assignment was buggy and the operation was being misused.

Let me know if any of this logic doesn't make sense and I need to make changes.

jsibley’s picture

Is there supposed to be a row in the disqus table for every node with disqus comments?

If so, and the Disqus table is empty, is there any way to rebuild it properly?

RobLoach’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)
mikeytown2’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Patch (to be ported) » Needs review
905 bytes

Still had an issue with this when running cron. Patch below fixes it for us.

For the curious here is output from module_implements('cron'); on our setup.

Array (
    [0] => masquerade
    [1] => dblog
    [2] => filter
    [3] => node
    [4] => poll
    [5] => statistics
    [6] => system
    [7] => captcha
    [8] => ctools
    [9] => date_timezone
    [10] => googleanalytics
    [11] => media_youtube
    [12] => path_redirect
    [13] => scheduler
    [14] => userpoints
    [15] => video_s3
    [16] => video
    [17] => views_data_export
    [18] => votingapi
    [19] => userpoints_top_contributors
    [20] => rules
RobLoach’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

neelan’s picture

I used the give patch above #5 "http://drupalcode.org/project/disqus.git/blob/887b8b5:/disqus.module".
After replacing the module file. i can see that every node has the tick mark ON "enable the Disqus comment" in default of node edit form.
But while viewing node, Disqus is not appearing. I tried to run the cron also.
What i have to do for the getting disqus for missing nodes again.

(FYI, I am using Acidfree album module for importing bulk images which converts each images into node. While adding image node without using bulk import, disqus is working. )