Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Like the comment module, allow comments to be toggled for every individual node who's node type has Disqus enabled.
Comment | File | Size | Author |
---|---|---|---|
#30 | 273853.patch | 1.78 KB | RobLoach |
#18 | disqus.patch | 5.99 KB | RobLoach |
#17 | toggle-d7-273853-17.patch | 7.07 KB | dstol |
#14 | per-node.patch | 10.61 KB | dstol |
Comments
Comment #1
czarphanguye CreditAttribution: czarphanguye commentedI also have this feature request and also on a node type bases. (For example, no disqus comments on quote nodes.)
Comment #2
wmostrey CreditAttribution: wmostrey commentedIt is already possible to enable/disable Disqus comments per content type but I echo the original poster's request to be able to do this on a node-per-node base in the same way that the core comment module allows for this.
Comment #3
xerexes CreditAttribution: xerexes commentedYeah I have a lot of older content I have moved to read only for comments and since switching to DISQUS all of those nodes are open to commenting again. I'd like an ability to use DISQUS only going forward - this might be hackable actually (I just need to set it for a certain value of node in the DB and up I think) but it would be nice to have it in the admin. I would imagine a lot of people would have my concern with switching to a new comment system.
Comment #4
kevinquillen CreditAttribution: kevinquillen commentedIs there a way to disable Disqus on user pages? It is throwing a JS error.
Comment #5
basvredelingHaving this as an option in the module would be very helpful.
+1
Comment #6
RobLoachKevin: I believe you can find that in the access permissions page.
Comment #7
redram CreditAttribution: redram commentedNode-level comments is a requirement, so we are going to have to revert back to core comments. Too bad. I like this disqus module.
Comment #8
RobLoach...... or you could help out with a patch :-) .
Comment #9
kevinquillen CreditAttribution: kevinquillen commentedCouldn't the response from the DISQUS call be parsed and created into comments attributed to that node on demand/during cron? Then add 'via (servicename)' at the bottom? Seems like the first approach. Just spitballing. Then you could still have the DISQUS interface to enter comments, but the core comment module displays them on the node.
Comment #10
RobLoachThat might be more complicated then it really needs to be. All we really want here is the ability to have node-level Disqus settings. Synchronizing on cron, and then altering Drupal core's comment module could get a bit hairy.
Comment #11
kevinquillen CreditAttribution: kevinquillen commentedOh, it sounded like #7 wanted the Disqus comments as real comments on the node. My bad.
Comment #12
RobLoachKevin: Did you manage to find out how to disable Disqus on the user profiles?
Comment #13
houstonaplus CreditAttribution: houstonaplus commentedDon't know if this has been addressed already but you can toggle disqus on a node by node basis (provided that the content type is enabled) by using $node->disqus_comments (available in the development version). For example, if you have a custom template, and your user has enabled or disabled comments for that node, you can write a simple code like the following:
Comment #14
dstolHere's a patch for this functionality applied against dev 6.x-1.x-dev
Comment #15
RobLoachThanks! This is awesome. I made some small tweaks...
http://drupal.org/cvs?commit=446054
Comment #16
dstolThanks Rob, I'll also look into the D7 version too.
Comment #17
dstolAs promised.
Comment #18
RobLoachI updated the patch to the latest DRUPAL-7--1. Not sure why the update.php isn't registering the update function.
Comment #19
erdembey CreditAttribution: erdembey commented@Rob Loach is this patch applied to the latest v7 release ?
I've tried to solve this issue via special field for this in content types and block visibility php code but no luck.
It will be great to have a solid solution for this issue.
Thanks.
Comment #20
RobLoachCommitted to DRUPAL-7--1 http://drupal.org/cvs?commit=483904
Comment #21
dstolWoo! Releases soon?
Comment #22
RobLoachOf course! http://drupal.org/node/1030556 ...... The problem with the patch was that drupal_write_record($something,$something, 'nid') in Drupal 7 only updates and does not insert if the record doesn't exist.... Weird, yes. Might be a Drupal core bug. Think we should make an issue?
Comment #23
erdembey CreditAttribution: erdembey commented@Rob Loach Thanks, i will try as soons as possible.
Also if there is a bug, we should create an issue ? ;)
Comment #24
dstol@Rob, yeah that sounds strange to me, I wonder if the table was primed with some fake data first if it will run an insert.
Also, no love for 6.x?
Comment #25
RobLoachHaha :-) ....... If you test out 6.x-1.x-dev and say it's good, I'd be more then happy to tag a release off that.
Comment #26
dstolI've been running it without issue on my blog since #15, granted it gets no traffic but the functionality works as expected.
Comment #28
patrickfgoddard CreditAttribution: patrickfgoddard commentedI'm having an issue where the enable Disqus comments is viewable/editable for all roles that have permissions to create a node, but I only want certain (admin) roles to control this. Desired workflow would be: all nodes (of a specified content type), would have disqus comments on by default, but only roles with permission could toggle per-node comments on/off. Currently, this feature is on for anyone with access to create a node. Unless I'm missing something?
Comment #29
Netrics CreditAttribution: Netrics commented@thund3rbox
This is happening to me too but in 6.x. I am currently going through the code to see if I can find a fix.
EDIT: I made a change in the hook_form_alter() function to include a new permission to handle the display for roles without the permission enabled. Personally I believe if we include the ability to change it for each node type the amount of permissions settings will be to many. The functionality for this feature should be reviewed. I believe we should have an option when editing a content type to include disqus comments or not, that or at least allow the user that has access to add that content type to enable disqus comments or not.
Comment #30
RobLoachComment #31
rickmanelius CreditAttribution: rickmanelius commentedHi Rob. I'm assuming the patch in #30 is for 6.x even though the version is set for 7.x?
Comment #32
RobLoachNope, that's for 7.x :-) . Gotta fix in 7 before we get it into 6. Needs a review.
Comment #33
rickmanelius CreditAttribution: rickmanelius commentedPatch #30 worked for me on D7 with the latest, dev version of disqus. I can confirm that I'm seeing the proper behavior for all roles as well.
Feel free to set back to 'needs review' if you need additional reviewers.
Comment #34
RobLoachDrupal 7: http://drupalcode.org/project/disqus.git/commitdiff/566d72d
Drupal 6: http://drupalcode.org/project/disqus.git/commitdiff/16c4d0e
Thanks so much for the help!
Comment #37
Rob230 CreditAttribution: Rob230 commentedIs it possible to control Disqus via code? From reading this thread it looks like you added manual control for a user to disable the comments for a particular node using the interface. That's fine for a blog or something, but I need automatic control that will be interpreted every time the page is made according to the node's fields etc.
I don't need direct support in the Disqus module, I just need to know if this is possible in a custom module/theme, e.g. in a preprocess function. Is there something in the $variables that I can change to instruct Disqus how to behave? If someone could give me some pointers that would be great. In some situations there will be no comments, in some situations comments will be allowed, and in others the comments will be visible, but not open to new comments. This functionality is vital to me and I'm hoping I'll be able to use Disqus.
As a backup, I suppose I could automatically set the "allow Disqus comments" setting of a node when conditions have been met in a hook_node_presave().
Comment #38
slashrsm CreditAttribution: slashrsm commentedSure. Disqus comments are added to page in form of an element. Depending how you display it (content area or block) you probably want to use hook_block_view_alter(), hook_page_alter() or something in that direction.
Comment #39
Rob230 CreditAttribution: Rob230 commentedI had a look at the Disqus module. It looks like I can use hook_node_load() and unset $node->disqus. That's easy enough. But I don't know how I can show Disqus comments without allowing new comments. I can't see anything in the Disqus module which does that, and I can't find any options for it on the Disqus website. All I can find is the setting to close comments automatically after a certain number of days. Perhaps it isn't configurable more than that. I will ask Disqus support.
Edit: After looking at disqus_node_delete() it looks like I might be able to use the API to call this: https://disqus.com/api/docs/threads/close/
Comment #40
slashrsm CreditAttribution: slashrsm commentedYou should be able to close threads via Disqus admin interface. You can't do this via Drupal module.
Comment #41
Rob230 CreditAttribution: Rob230 commentedHmm. I emailed Disqus support and they also said it wasn't possible. However, I have done it easily. I just used the API and called $disqus->threads->close(). I based it on the code that's already in the Disqus module for deleting threads, since the remove() and close() calls take the same arguments.