Saturday, August 27, 2011

Facebook logout problem php solved

After two days of searching, i have found a problem solved link and i wanted to share it with you all. Put this line in your logout script before redirect to Facebook logout.

$session = $this->facebook->getSession();
$logoutUrl = $this->facebook->getLogoutUrl(array('next' => base_url(), 'session_key' => $session['session_key']));
setcookie('fbs_'.$this->facebook->getAppId(), '', time()-100, '/', '.domain.com');
$this->session->sess_destroy();
redirect($logoutUrl);

I got it from this link http://forum.developers.facebook.net/viewtopic.php?id=71219.

Hope it help someone.

Monday, August 22, 2011

Addthis and ajax response page

There are lots of post regarding Addthis api usage for AJAX page. But none of the post worked perfectly for me. However i got some idea from all that posts to implement it. Here is my code, made little changes from different post.

var addthisScript = "http://s7.addthis.com/js/250/addthis_widget.js#domready=1";/>

function initAddthis(){
if (window.addthis){
window.addthis.ost = 0;
window.addthis.init();
}
}

When you load page using ajax for example (here i have used jQuery)
$.load('http://example.com/lists',function(){
if(window.addthis != undefined) {
  delete window.addthis;
}
$.getScript( addthisScript , function(){
initAddthis
});
});
Please let me know, does it work for you.