Browse Source

Adding intval to api_get_user_id

Julio Montoya 15 years ago
parent
commit
d72377bfb5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      main/inc/lib/main_api.lib.php

+ 2 - 2
main/inc/lib/main_api.lib.php

@@ -745,10 +745,10 @@ 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
+ * @return integer the id of the current user, 0 if is empty
  */
 function api_get_user_id() {
-	return empty($GLOBALS['_user']['user_id']) ? 0 : $GLOBALS['_user']['user_id'];
+	return empty($GLOBALS['_user']['user_id']) ? 0 : intval($GLOBALS['_user']['user_id']);
 }
 
 /**