Nasir
Nasir

Reputation: 431

Check if the front end user is log in or not

I am using "front-end-only-users" plugin for user registration and log in system. Now how i check that my front end user is log in or not through coding i use 'is_user_logged_in()' but it checking the admin panel user.

Upvotes: 0

Views: 1366

Answers (1)

sarath
sarath

Reputation: 700

Try

if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
} else {
    echo 'Welcome, visitor!';
}

OR Try this

global $current_user;
get_currentuserinfo();
if ($current_user->ID == '') { 
    //show nothing to user
}
else { 
    //write code to show menu here
}

Upvotes: 2

Related Questions