Is there a Drupal function to check if the user is logged in?
Date Published: February 5, 2025
Yes, and the function to use depends on the version of Drupal that you're using with your website.
Drupal 6 and 7
The function to use is called user_is_logged_in, and it can determine if a given user is logged in. For complete documentation on the function, click the appropriate link from the following, based on your Drupal version: