Check User Status - PHP

Hey Guys.

I put together a code which greets a user when logged in.

But i need the variable which finds out if the user is not logged in so the greeting echo will not display.

Currently its displaying "good morning", _____ for non logged in users.

Its not related to the plugin directly i know, but i just need the variable :slight_smile:



        global $current_user;
        /*echo get_avatar( $current_user->ID, 64 );*/
        $hour = date('G');
        if ($hour < 12) {
	        $greeting = 'Good Morning';
	  } else if ($hour < 18) {
		    $greeting = 'Good Evening';
  	  } else {
	  	    $greeting = 'Good Night';


echo '<div class="greeting">'.$greeting.' , '.$current_user->user_login. '</div>';