I would like to be able to call a javascript function when someone posts a comment. Is this possible? I searched the documentation on disqus and I didn't see anything about this. There is a setting for enabling this under disqus settings.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | disqus-7.x-1.x-comment-alerts-20.patch | 6.75 KB | freakalis |
| #17 | disqus-7.x-1.x-comment-alerts-17.patch | 5.51 KB | freakalis |
| #14 | disqus-7.x-1.x-comment-alerts-14.patch | 4.52 KB | prashant.c |
| #13 | disqus-7.x-dev-comment-alerts-13.patch | 3.33 KB | attheshow |
| #10 | disqus-7.x-dev-comment-alerts-10.patch | 3.34 KB | attheshow |
Comments
Comment #1
kate commentedIn case anyone else has this question.... I asked disqus support for the answer and they pointed me to the help page that describes how you can capture 'Disqus commenting activity':
http://docs.disqus.com/help/60/
Comment #2
robloachInteresting, would be neat to add this to some kind of Drupal JavaScript hook or something.....
Comment #3
robloachComment #4
bryancasler commentedsubscribe
Comment #5
sean_a commentedI couldn't get a patch made via git but here is the first stab at this. Posting on behalf of my team member Jennifer.
Changed files are disqus.module and disqus.js
changes/testing welcome!
This is for 6.x branch
Comment #6
sean_a commentedok I think I patched it right. (attached) please review either patch or .zip file in previous comment
Comment #7
bryancasler commentedsean_a is the patch in #6 for the 6.x branch or 7.x branch?
Comment #8
sean_a commented6.x- sorry I realize this is a 7.x feature request but there wasn't another discussion about this feature
Comment #9
patrickroma commentedIs there also a working version of this for D7? This is really cool!
Comment #10
attheshow commentedHere's a patch for 7.x-1.x-dev with the code from #6 improved a bit and refactored for D7. Works nicely for our site.
Comment #11
attheshow commentedOne note: When using the patch from #10 above, you need to probably give both anonymous users and authenticated users the "Notify Disqus node author" permission. This will allow the notifications to be sent out if you wish.
Comment #12
attheshow commentedYou'd also need to clear your cache after applying the patch. There are changes to both the Javascript and menu callbacks.
Comment #13
attheshow commentedUpdated patched. I cleaned up a couple of whitespace issues.
Comment #14
prashant.cI tried the patch posted by #10 with 7.x-1.x-dev but it had some issues and not notifying the node author.
Made modifications
1. Modified code in diqus.js file.
2. It was not fetching node id sent by drupal_add_js() function arguments in disqus.module file.
3. 2 arguments were coming in 'identifier' array. Splitted the node id from it.
Now the patch is working with both 7.x-1.x-dev and 7.x-1.9.
Please review the patch.
Comment #15
slashrsm commentedJS callback support has been already added to current 7.x-1.x-dev. See http://drupalcode.org/project/disqus.git/blob/refs/heads/7.x-1.x:/disqus... for more info.
Comment #16
joel_osc commentedThis is really fantastic functionality. Does anyone have some sample code for this? Specifically, I would like to tie my disqus commenting into flag (follow) so users are automatically set to follow nodes when they leave a comment - like drupal.org.
Comment #17
freakalis commentedHere is a new patch based on the previous patches but using the new builtin JS Callback support. I also stops logged in Drupal users from getting notified when they are commenting on a node that they created themself.
Comment #18
slashrsm commentedThis shouldn't live inside Drupal.behaviours, but something like Drupal.plupload.notifyAuthor.
Whitespace.
We can kill .csvignore entirely.
Drupal./.../.notifyAuthor?
Also whitespace in last line.
We probably want email content to be configurable.
Newline and few more whitespace issues all around the patch.
This will be world open in 90% cases. Can we implement this a bit more securely? Token check or something like this?
Comment #19
slashrsm commentedComment #20
freakalis commentedNew patch fixing the problems reported in comment #18.
E-mail is now configurable with Token support at settings page. Added a CSRF token.
Comment #21
slashrsm commentedDoes this provide any security at all (for anon)?
Newline still missing.
Comment #22
freakalis commentedI tried using only drupal_get_token() but that did't work for anonymous users because they don't have a session. I found this token solution in Flag module. Do you have a better solution that doesn't require a session for every user?
Comment #23
slashrsm commentedI believe the only secure way is to create a session for anon users.
Comment #24
zonesny commentedThanks @freakalis and @slahrsm for all of the great work on this feature. Can someone please clarify the status of the patch in #20? Does it need to be tested further by the community, or will it be committed, etc.?
Comment #25
girishmuraly commentedIf any custom/contrib module has prepended a new #post_render function to 'disqus' and set an 'onNewComment' callback, then this code is wiping it out. How about using
$element['#disqus']['callbacks']['onNewComment][] = 'Drupal.disqus.notifyAuthor';
instead?
Also, it seems possible to completely implement callbacks in custom modules by implementing new #post_renders like above, so is it worth adding all this to this module?
Comment #26
slashrsm commented@zonesny: This patch is not ready to be committed (as per #21 and #23).
#25 raised a fair question. I'd say that we can add this, but it must be done in a secure, simple and reliable way.
Comment #27
girishmuraly commented@slashrsm perhaps it can be a submodule, like in https://drupal.org/comment/8692701#comment-8692701?
Comment #28
slashrsm commentedThat also works.
Comment #29
vgutekunst commentedHi,
i use 7.x-1.10+7-dev and the patch #20 but the email notification doesnt work? Any help with that? Isnt the patch working with 7.x-1.10+7-dev?
kind regards,
Comment #30
vgutekunst commentedIt seems Token dont works correct in this case. [node:author:mail] dont work thats why the email notification doesnt work! Any help i this case'?
Comment #31
vgutekunst commentedany progress in the meanwhile'''?
Comment #32
karamveersingh commentedhi guys!
I have integrated Disqus-Version: 7.x-1.12 and core feature working fine, but I am looking -> notify to Drupal-Article author when someone posted comments.
Please suggest me above which patch I can use for full-fill my requirement?
Comment #33
karamveersingh commentedany update ?