Not sure if I’m heading in the right direction or just a dunce. Probably a dunce.
<?php if ( is_user_logged_in() ) { ?>
<?php global $user_login , $current_user;
get_currentuserinfo();
echo ‘Welcome’ . $current_user;
?> } else {
wp_register();
}
?>
Either:
<?php if ( is_user_logged_in() ) {
global $display_name;
get_currentuserinfo();
echo 'Welcome' . $display_name;
} else {
wp_register();
}
?>
Or:
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
echo 'Welcome ' . $current_user->display_name . "\n";
}
else {
wp_register();
}
?>
If you use $current_user as the global variable, you can access all the info using the methods (i.e. user_login, display_name below this).
Other than that you can declare the globals individually as you have in your example, but they must be the same as the ones available in the currentuserinfo function.
It explains this on this link which I posted previously. Spend sometime reading and understanding the differences between the two explanations.
http://codex.wordpress.org/Function_Reference/get_currentuserinfo#Default_Usage
Thanks. I read it, but I’m slowly understanding it.