6.x user.module user_is_logged_in()
7.x user.module user_is_logged_in()
1 string reference to 'user_is_logged_in'
user_menu in modules/user/user.module
Implementation of hook_menu().


modules/user/user.module, line 890
Enables the user registration and login system.


function user_is_logged_in() {
  return (bool) $GLOBALS['user']->uid;


zhilevan’s picture

this is good solution when we want check the menu only for users login , can use this in access callback menu property like this

$items['custmomenu'] => array(
      'title' => 'yourtitle',
      'page callback' => 'yourcallback function' ,
      'access callback' = > user_is_logged_in(),

the usefull and short solution

Yaron Tal’s picture

That should be:
'access callback' => 'user_is_logged_in',

Otherwise it will become TRUE/FALSE depending on the status of the user when menu cache is refreshed and all other users will (not) get access till the next menu cache refresh.

And don't forget to return $items.