$user


User Methods

$user->isGuest()

Introduced in Version 2.0

Description

Is this the Guest user? Returns true or false.

Because this is a boolean (true/false) we can create simple if statements to determine the current user's guest status:

if ($user->isGuest()) {
    // Show some content specifically for guests
} else {
    // Show different content for logged-in users
}

Related

Post Comment