I check content-types in admin/settings/disqus where i want to use disqus comments. But i don't want disqus enabled by default on all nodes of this content types.

I could override $node->disqus['status'] on hook_nodeapi of module of mine, but i'll have to make another db_query request, which is not really good.

So i patch disqus module to add new option : 'Enabled by default on contents'.
When checked, all contents of checked content types will have disqus comments by default. If it's unchecked, you will have to check each contents where you want to have disqus comments on them.

Patch on next comment.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GoZ’s picture

Status: Active » Needs review
FileSize
2.34 KB

Here is the patch

mogwaay’s picture

This appears to be a duplicate of this issue https://drupal.org/node/2000098.

I'm not sure that this patch will work as expected, for the same reasons that the patches on https://drupal.org/node/2000098 don't work - the 'disqus' table appears to currently work as an exclusion list - ie, all nodes which should not have the comments shown.

Because of this it's impossible to tell the difference between a node which had comments set to YES and a node which has never had this setting specified (as the assumption is not-in-disqus-table = YES).

$status = db_fetch_object(db_query("SELECT status FROM {disqus} WHERE nid = %d", $node->nid));
node->disqus['status'] = isset($status->status) ? (bool)$status->status : (bool) variable_get('disqus_default_enabled', TRUE);

$status here will never be set to 1 as the table only lists nodes with status set to 0 (see drupal_node_update() - runs drupal_node_delete() if show comments set to TRUE?!). Therefore comments will never show if the default is set to FALSE.

I hope I've got the logic correct here - massive apologies if I'm mistaken...