Tutorial: how to check if user is logged in or a visitor
-
Most people find it hard to make a theme that actualy checks if the visiter is a member or visiter. Most people thinks it’s is_user_logged_in but it’s not.
Instead add this code to your functions.php
<?php function user_regvis_message() { get_currentuserinfo() ; global $user_level; if ($user_level > 0) { echo "Wellcome visiter" } else { echo "Wellcome Member" } }; ?>
then add this in any location of your theme
<?php user_regvis_message(); ?>
Quick note; if your including tags do not use echo instead just place the code the fuction dose if for you
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Tutorial: how to check if user is logged in or a visitor’ is closed to new replies.