|
|
|
|
@ -1260,13 +1260,13 @@ function api_is_self_registration_allowed() |
|
|
|
|
* |
|
|
|
|
* example: The function can be used to check if a user is logged in |
|
|
|
|
* if (api_get_user_id()) |
|
|
|
|
* @return integer the id of the current user, 0 if is empty |
|
|
|
|
* @return int the id of the current user, 0 if is empty |
|
|
|
|
*/ |
|
|
|
|
function api_get_user_id() |
|
|
|
|
{ |
|
|
|
|
$userInfo = Session::read('_user'); |
|
|
|
|
if ($userInfo && isset($userInfo['user_id'])) { |
|
|
|
|
return $userInfo['user_id']; |
|
|
|
|
return (int) $userInfo['user_id']; |
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|