Most people thinks it’s is_user_logged_in but it’s not.
Are you sure about that? For instance, the WordPress core uses is_user_logged_in to decide if a user is prompted with “Log in” or “Log out” prompt when a template uses the wp_loginout() tag.
This is not correct: first of all the Visitor and Member greeting are mixed up. Secondly: a subscriber has user level 0.
get_currentuserinfo() ;
global $user_level;
if ($user_level > 0) {
echo "Welcome Contributor (or higher)"
} else {
echo "Welcome Visitor or Subscriber"
}
I agree with MichaelH: stick to is_user_logged_in
The above described function could be useful to see if someone is more then just an anonymous subscriber (aka a contributor of higher). I use this to allow people to disable ads when they contribute by writing articles (posts).
global $userdata;
get_currentuserinfo();
if ($userdata->user_level > 0) {
if(function_exists('get_cimyFieldValue')) {
$value = get_cimyFieldValue($userdata->ID, 'FIELDNAME');
if ($value == 'YES') { $ads = 'off'; }
}
}
I’ve tried playing with these and can’t get them to do what I want
In essence, what I’m trying to do is with the top of the sidebar, I want (plain language coding) –
if (is_home()) OR if not a user
~ do this ~
then
~ this ~ (if user or not)
I can get it to work with the is_home command() on it’s own, and I can get it to work with the !is_user_logged_in() on its own, but when I try to run the || (or) php in the middle of them I get a T_syntax (OR) php error and the sidebar fails to load.
It’s starting to drive me nuts because I want the condition to simply be –
If it’s the home page or it’s not a logged-in user (on any page or post), then show the sign up form
Why is this so difficult?
Can anyone help this grump old geezer?