Nas últimas semanas procurei bastante e testei diversos plugins para adicionar a caixa de comentário do Facebook e os botões Like. Nos meus testes o que fez o proposto com mais facilidade foi o Plugin Total Facebook.
Já que o Facebook não notifica automaticamente sobre novos comentários e Likes eu decidi utilizar o Javascript SDK para verificar quando um comentário ou Like são feitos e fazer uma requisição (ajax) a uma página que seria a responsável por me notificar.
Diversos testes meus, retornavam que o objeto FB era inexistente (Uncaught ReferenceError: FB is not defined), que o FB.init já havia sido chamado (FB.init has already been called – this could indicate a problem) e outros erros. Então, modifiquei a função fbsdk_includeWFC() para fazer inicialização assincrona e cadastrei um método para ser chamado quando os eventos “comment.create” (comentário) e “edge.create” (like) forem disparados.
[code lang=”php”]
function fbsdk_includeWFC(){
$wfcglb = get_option(‘wfc_global’);
echo ”
window.fbAsyncInit = function() { FB.init({ appId : '" . $wfcglb['appid'] . "', // App ID //channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML });
FB.Event.subscribe('comment.create', function (response) { jQuery.ajax({ url: 'test.html', //success: function (data) { alert(response.href); }, //error: function (data) { alert(response.href); } }); }); };
FB.Event.subscribe('edge.create', function (response) { jQuery.ajax({ url: 'test2.html', //success: function (data) { alert(response); }, //error: function (data) { alert(response); } }); }); };
(function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = '//connect.facebook.net/en_US/all.js'; ref.parentNode.insertBefore(js, ref); }(document));“;
echo ““;
}
[/code]
Agora você pode modificar as funções adicionadas em event.subscribe, fazer uma requisição para uma página PHP, passando como parametro a referencia e esta pagina ficara responsavel por enviar um e-mail para você.
Matheus
https://cxadxqpked.wordpress.com
https://iqakruyprf.wordpress.com
https://dgaiyziytk.wordpress.com
Heya i’m for the first time here. I found this board and I find It truly useful & it helped me out a lot. I hope to give something back and help others like you aided me.
Very good info. Lucky me I discovered your site by chance (stumbleupon). I have book marked it for later!
We are a gaggle of volunteers and starting a brand new scheme in our community. Your web site offered us with helpful information to work on. You’ve performed an impressive activity and our entire community shall be grateful to you.
I think that is one of the most significant information for me. And i’m glad reading your article. But should commentary on few normal things, The website taste is ideal, the articles is in point of fact great : D. Good activity, cheers
Wonderful blog you have here but I was wondering if you knew of any forums that cover the same topics talked about here? I’d really like to be a part of online community where I can get comments from other experienced people that share the same interest. If you have any suggestions, please let me know. Thanks!
https://jtgcuqvaay.wordpress.com
https://ugqawktzhq.wordpress.com
https://ugqawktzhq.wordpress.com