function user_service_logout in Services 6.2
Same name and namespace in other branches
- 5 services/user_service/user_service.module \user_service_logout()
- 6 services/user_service/user_service.inc \user_service_logout()
- 7 services/user_service/user_service.inc \user_service_logout()
Logout the current user.
1 string reference to 'user_service_logout'
- user_service_service in services/
user_service/ user_service.module - Implementation of hook_service().
File
- services/
user_service/ user_service.inc, line 113 - Link general user functionalities to services module.
Code
function user_service_logout() {
global $user;
if (!$user->uid) {
// User is not logged in
return services_error(t('User is not logged in.'), 406);
}
watchdog('user', 'Session closed for %name.', array(
'%name' => theme('placeholder', $user->name),
));
// Destroy the current session:
session_destroy();
$array = array();
user_module_invoke('logout', $array, $user);
// Load the anonymous user
$user = drupal_anonymous_user();
return TRUE;
}