0

OK, so this a bit tricky, but there has to be some way to do this with facebooks FB.event?

The setup and problem.

Every K2 item (page) has a comment box. Need to notify AUTHOR of said page when comments are made on their entries

So when someone makes an entry on the facebook comments box, I want to make sure that the specific author is notified via email that a comment has been made. I'm thinking that one would first have to create some sort of variable for each author and then connect that wwith their specific email. Then write some FB.event handler sending email based on the author.

Is there anyone who can help me figure out how to do this?

EDIT Please follow this link PHP variable from external file? for a complete solution on this subject and what I was trying to accomplish here.

Community
  • 1
  • 1
axelra82
  • 517
  • 8
  • 23
  • 2
    Show your efforts first please, and ask about any facing troubles. – Maks Gordeev Feb 17 '13 at 17:37
  • Thats the problem thou. I don't know where to begin... Was hoping someone could point me in the right direction to get going. – axelra82 Feb 18 '13 at 14:16
  • OK, so this is what I have so far. – axelra82 Feb 20 '13 at 16:04
  • – axelra82 Feb 20 '13 at 16:06
  • and then FB.Event.subscribe('comment.create', function(response){ item->author "you've got mail."; $from = "info@mydomain.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); ?> }); }; But this only messes something up and gives a "server error" when looking at the page – axelra82 Feb 20 '13 at 16:07

2 Answers2

0

You need to use FB.Event.subscribe and subscribe to the comment.create event. On firing that event you can call an ajax function to send an email.

Reference: http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

Nayla
  • 16
  • 5
  • YES! I've been looking at exactly this :) However, I don't understand how to use it :( I understand that I need to use the comment.create but is there a more detailed documentation somewhere to understand it better? Maybe some more (usable) examples for how it works? Thank you for your reply – axelra82 Feb 19 '13 at 08:01
  • I tried using the suggested code on http://stackoverflow.com/questions/9395789/solved-fb-comments-events-comment-create-and-comment-remove-not-working but nothing happens when I try it out. – axelra82 Feb 19 '13 at 08:59
  • I've also found this http://stackoverflow.com/questions/9894805/notify-facebook-application-admin-when-comments-are-posted-using-social-plugin?answertab=votes#tab-top which is precisely what I'm looking to do. Could someone help me clarify the answer? It referes to "facebook_notification.php" where do I put that and what should it contain? And how does this part work "FB.Event.subscribe('comment.create', function(response){ var dummyImage = new Image; dummyImage.src = 'http://example.com/facebook_notification.php?path='+response.href.replace('http://',''); });"? – axelra82 Feb 19 '13 at 09:21
  • This is what I have now http://stackoverflow.com/questions/14988508/fb-event-subscribe-comment-create-acting-without-action-from-user – axelra82 Feb 21 '13 at 10:43
0

I have used K2 before and had the same problem. This auto notify functionality will soon be added to k2 core .

Currently K2MULTINOTIFY can be used to add this functionality

Also Take a look at this k2 forum thread. Might be helpful. http://getk2.org/community/New-to-K2-Ask-here-first/130778-Notification-of-new-comments-by-email

Arun Unnikrishnan
  • 2,339
  • 2
  • 25
  • 39
  • Thank you for your reply. However, these links don't adress the issu at hand. They refer to notifications on the built in comments from K2. I'm using facebook comments https://developers.facebook.com/docs/reference/plugins/comments/ embedded in each item (article). So I need to get some sort of "on comment made, send email to [author]". I'm pretty sure this could be done using FB.event to trigger a PHP "if, else if" or something. But I'm not that proficient in PHP and know little (to none) on FB.events. Thats where I need help to get started ;) – axelra82 Feb 19 '13 at 07:58