Drupal – Check if user has logged in

The following piece of codes check if the Drupal visitor is logged in or not.

...
if (user_is_logged_in()) {
  // user is logged in
} else {
  // anonymous user
{
...

 

Done =)

Reference: Drupal API – user_is_logged_in

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.