function user_service_logout in Services 7
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()
- 6.2 services/user_service/user_service.inc \user_service_logout()
Logout 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 100 - @author Services Dev Team
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();
module_invoke_all('user', 'logout', NULL, $user);
// Load the anonymous user
$user = drupal_anonymous_user();
return TRUE;
}