I use
<?php wp_register(); ?>
<?php wp_loginout(); ?>
add a login panel on the top of my page.
but when I login in, it just show * Site Admin * Log out
I have tied some diffrent users, they all show * Site Admin
I noticed the login information in wp-includes/general-template.php
line 254-296, how to modify the code that can show welcome username, * Site Admin * Log out
thanks.
Iām first to admit that my PHP foo is not strong, and this is untested, but should work:
if ( is_user_logged_in() ) {
global $display_name;
echo "Welcome ".$display_name.", ";
wp_loginout();
} else {
wp_register();
wp_loginout();
};
From: http://codex.wordpress.org/Function_Reference/get_currentuserinfo
Thanks seriocomic,
I got the anwser from wordpress.org forum help.
This can show the username, But If I add a li tag like this , it can not show the li, do you have any idea? Thanks again.
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
echo 'welcome '.$current_user->user_login.'<br />';
wp_register();
}
'<li>'.wp_loginout().'</li>';
?>
echo '<li>';
wp_loginout();
echo '</li>';
right, echo ā<li>ā is a correct way.
Thanks php_daemon.