Needs work
Project:
Facebook Comments Social Plugin
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2012 at 13:01 UTC
Updated:
18 Jan 2021 at 04:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
swentel commentedbetter title
Comment #2
swentel commentedAnd here's the patch.
Comment #3
swentel commentedNew patch coming to notify per node author as well.
Comment #4
swentel commentedNew patch. Notify can work per node author as well.
Comment #5
swentel commentedUpdated patch fixing some notices + it also had the extra_fields hook which is in another patch.
Comment #6
Stalski commentedChanged default behavior.
Now if the global setting is filled in, those recipients are used while appending the node author as well.
From now on, if the global settings field is left empty, a notificiation will still be sent to the author of the node.
- Edit - patch corrupt, swentel will attach a new one with more fixes.
Comment #7
swentel commentedPatch was corrupted.
Comment #8
jay.lee.bio commentedAm I the only one getting the following error after applying the latest patch to the latest dev version?
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'f.notify' in 'field list': SELECT f.enabled AS enabled, f.amount AS amount, f.notify AS notify FROM {facebook_comments} f WHERE (f.nid = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 1 ) in facebook_comments_node_view() (line 330 of /home/mysite/public_html/sites/all/modules/facebook_comments/facebook_comments.module).
Comment #9
swentel commentedYou need to run update.php
Comment #10
jay.lee.bio commentedThanks swentel, I successfully ran update.php. Here are the results of what happened:
1) I did get it working on two test servers, sort of. To elaborate, I only get notification to the email address that I put in the "E-mail addresses" field (which itself is very important, so that you can set whoever you want to get notified of ALL comments posted on your site). None of the actual authors of the content get notified (when I click on "Facebook comments notify" under the Navigation block, I get the WSOD).
2) On one of my test servers, I keep getting a gazillion of the following messages at http://mysite.com/admin/reports/dblog:
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'uid' at row 1
3) On a new test server I set up just for this module, I keep getting the following error messages at http://mysite.com/admin/reports/dblog:
Notice: Undefined index: url in facebook_comments_notify() (line 413 of /home/mysite/public_html/sites/all/modules/facebook_comments/facebook_comments.module).
Notice: Undefined index: id in facebook_comments_notify() (line 414 of /home/mysite/public_html/sites/all/modules/facebook_comments/facebook_comments.module).
Notice: Undefined index: nid in facebook_comments_notify() (line 415 of /home/mysite/public_html/sites/all/modules/facebook_comments/facebook_comments.module).
4) If I'm not logged in as admin, Facebook Comments don't show up for content created.
Comment #11
swentel commentedThat's weird, did some retests and works fine here. Updated the patch here to have another default behavior, namely if you toggle the notify author on node, then the global email address is ignored. In testing here, that seemed the better behavior of this module.
Added some checks on the post variables as well, so the nid/id/url notices should be fine now.
- Edit - why it doesn't show as non admin beats me, that's another issue I think - works fine here, even anonymous
Comment #12
jay.lee.bio commentedSwentel, you're a genius. Thanks for the newest patch. I tested it, and after spending hours (and almost giving up mostly due to "operator error" lol), I finally got it working. I might write a blog about this experience that explains everything in detail (I need to do more testing), but I'm very happy for now. Here are my updates to #10:
1) Explained in detail below under "new suggestions" (A & B).
2) There were no errors on my newest test server, so you can ignore this now.
3) You just fixed this.
4) Ignore this as well, everything works well on my newest test server.
Here are new suggestions:
A) "Facebook comments notify" under the Navigation block still produces the WSOD error (I just disabled it), so you might want to fix it later.
B) I finally found the "Notify author on comment" checkbox under "Facebook comments" in the vertical menubar on the bottom while creating new content (I was distracted by "Facebook comments notify"). So yes, authors of content do get notified, overriding the global email address (which I agree is the better behavior). But I really think it should also be checked by default. To do this I changed line 267 of the patched version of facebook_comments.module to:
'#default_value' => $defaults->notify, -> '#default_value' => $defaults->enabled,
C) Can you make it also work for user profiles? It would be absolutely amazing if you can do this: http://drupal.org/node/1397524
D) I got the following error once at some point (I think maybe after initially applying the patch and leaving the global email address empty):
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'notify' at row 1: INSERT INTO {facebook_comments} (nid, enabled, amount, notify) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 15 [:db_insert_placeholder_3] => ) in facebook_comments_node_insert() (line 291 of /home/mysite/public_html/sites/all/modules/facebook_comments/facebook_comments.module).
I think the error disappeared after I filled in the global email address. However, I can't reproduce the error afterwards no matter what. I'm just letting you know that I did experience a weird error just once. Feel free to ignore it until someone else complains of the same error and can show the steps required to reproduce it.
Looking back at everything that I just wrote, I think C is most important for the next step. :D
Comment #13
constantinejohny commentedFor me it works perfectly. Big thanks! :)
Comment #14
SIX-P4cK commentedThis patch is to apply on the dev version or on the beta version?
i try with the dev version, everything look like ok on the interface but no email are send.
I think the function facebook_comments_notify() used to send e-mail is never call.
Where is the call on this methode?
edit: fixed: was missing file facebook_comments.js
then apply patch on dev version is working for me too
Comment #15
jay.lee.bio commentedHi Swentel, I finally remember exactly what I was talking about regarding #10, 4). Here are the steps to reproduce the problem:
1) Create a dummy test account and leave it with the default authenticated user status.
2) Log in as the test account.
3) Create content that already has this moduled enabled.
You'll see that there is no Facebook Comments where it normally should be. If you log back in as admin, press the edit button for the content that was just created but make no changes whatsoever and just press the save button, Facebook Comments will now show.
Can you look into this please?
P.S. When I said ignore this on #12, 4), I probably forgot exactly what I was talking about and didn't test this thoroughly to reproduce the error.
Comment #16
mcfilms commentedCan I just say this is brilliant and worked flawlessly for me. It's always satisfying when a client requests a new feature and you can research it, find the solution, and implement it in an hour. Good work swentel.
I switched the status to RTBC because it seems like everyone has had great success with this patch.
To answer six-pack's question, the patch IS against 7.x-1.0-beta2. I hope this feature gets rolled into the 1.0 release version.
Comment #17
Maglor commentedHi, I'm a total newbie when it comes to patches for Drupal. Can anyone explain me what I actually do with the code? Do I place it in the fb comments module folder or something?
Comment #18
mcfilms commentedMaglor, see http://drupal.org/patch/apply.
Comment #19
Maglor commentedWorks like a charm! Thanks for the link and for the patch!
Comment #20
LTech commentedI've applied the patch and under configuration -> facebook comments settings I checked the box: Notify when a comment is posted. and filled in my email address under E-mail.
However, when I post a facebook comment no email is sent.
and no error is showing on the site so how do I debug this?
What am I doing wrong?
Comment #21
mcfilms commentedFirst thing I'd confirm is that your site CAN send emails. Does the email under site configuration get notified of software updates? Does the site-wide contact form work?
Next I'd make sure the mail didn't get filtered by a spam filter.
After that, I'm running out of ideas.
Comment #22
LTech commentedThe site can send emails and the mail isn't in spam...
Is this code going to be part of the main module soon? It could be I put the code in incorrectly, but I did double check everything and I'm not getting any white screen errors.
Any other ideas will be appreciated.
Thanks
Comment #23
LTech commentedthe function drupal_mail works on my site but for some reason it isn't being called here. Could it be because my pages are built on panels?
Comment #24
mcfilms commentedWhat is the site's url? Are the FB comments posting?
I'm really not going to bu much help here. I switched all my commenting over to use Disqus.
Comment #25
LTech commentedmy test site is: https://www.thepetwiki.com/mg-testsite.com/ubercart/painting/my-childhoo...
yes the comments are posting.
Thanks for your help
Comment #26
LTech commentedWill this e-mail feature be committed to the next release or at least the dev version?
Comment #27
gregglesThe menu callback could be abused to send a lot of emails to someone, even in a CSRF-vulnerable manner.
It seems like it should get token protection (for CSRF) and maybe a throttle mechanism (i.e. flood protection).
Comment #28
LTech commentedI couldn't get this patch to work so I'm using a code I wrote.
You add the following to facebook_comments/facebook_comments.module
Then in the mail.php file:
And have a folder with PHPMailer.
This works really well but the issue is that sometimes I randomly receive emails that a message has been posted (I know it is a random email since there is no link in the $body from $_GET[response1]; and in facebook developers tool I can see no message has been posted).
Is this connected to post #27? How can I fix this?
Comment #29
jay.lee.bio commentedIt looks like the D8 version doesn't have this feature. Has anyone started working on a patch?