benfranklin
Member
Posted 2 years ago #
I basically just need to know how to check to see if a logged in user has a first name entered or not, and if they do echo "show" which is associated with a display: inline class and if it's not present just don't print anything or print hide which is associated with a style of display: hide ... so I can show or hide name depending on whether it is present or not.
benfranklin
Member
Posted 2 years ago #
Nevermind. I was being dumb. Here is what I did to solve this:
Welcome<span class="hide<?php global $current_user; get_currentuserinfo(); if ($current_user->user_firstname == true) { echo show; } ?>"> <? echo "$current_user->user_firstname" ?></span>!
Works well if you have hide as a style that hides and hideshow a style that shows.
Just missed it...
<?php
if ( is_user_logged_in() ) {
echo 'Welcome, registered user!';
if ( $userdata->first_name ) {
echo ' You have a first name of '. $userdata->first_name;
} else {
echo ' Please, visit your profile page and enter a First Name.';
}
} else {
echo 'Welcome, visitor!';
};
?>