Open cduarte opened 12 years ago
Same problem.
Update logout function in /views/helper/facebook.php to the following:
function logout($options = array(), $label = ''){ $options = array_merge( array( 'autologoutlink' => 'true', 'label' => 'Sign Out', 'custom' => false ), $options ); if(isset($options['redirect']) || $options['custom']){ if(isset($options['redirect']) && $options['redirect']){ $options['redirect'] = Router::url($options['redirect']); $response = "window.location = '{$options['redirect']}';"; } else { $response = "window.location.reload();"; } $onclick = "fbLogout();";
$scriptblock .= $this->Html->scriptBlock(
<<<JS
function fbLogout(){
if(typeof FB.logout == 'function'){
if (FB.getAuthResponse()) {
FB.logout(function(response) { $response });
return;
}
};
$response
return;
} JS , array());
if(isset($options['confirm'])){
$onclick = 'if(confirm("'.$options['confirm'].'")){'.$onclick.'}';
}
if(!empty($label)){
$options['label'] = $label;
}
return $scriptblock.$this->Html->link($options['label'], '#', array('onclick' => $onclick));
} else {
unset($options['label'], $options['escape'], $options['custom']);
return $this->__fbTag('fb:login-button', $label, $options);
}
}
@sacbhatia One minor correction
function logout($options = array(), $label = ''){ $options = array_merge( array( 'autologoutlink' => 'true', 'label' => 'Sign Out',
to
function logout($options = array(), $label = ''){ $options = array_merge( array( 'autologoutlink' => 'true', 'label' => $option, // will assign the text to link per parameter
I use this, but dont work:
<?php echo $this->Facebook->logout( array('redirect' => array('controller' => 'users', 'action' => 'logout', 'panel' => true) )); ?>
Using cakephp 1.3 Login function working perfectly.
Thanks.