youlichika
Member
Posted 1 year ago #
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 many diffrent users, they all show * Site Admin
I noticed the login information are in wp-includes/general-template.php line 254-296, how to modify the code that can show welcome username, * Site Admin * Log out
thanks.
Try this
`
<?php
wp_register();
?>
<?php wp_loginout(); ?>
Try this
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
echo 'welcome '.$current_user->user_login;
wp_register();
}
wp_loginout(); ?>
youlichika
Member
Posted 1 year ago #
@JohnC28 thanks, I this can echo the user name.
By the way, how to add a li tag? Thanks.
<ul>
<?php wp_register(); ?>
<?php wp_loginout(); ?>
</ul>
youlichika
Member
Posted 1 year ago #
<ul>
<li><?php wp_register(); ?></li>
<li><?php wp_loginout(); ?></li>
</ul>
youlichika
Member
Posted 1 year ago #
I modified the code like this ,but the li tag still lost...
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
echo 'welcome '.$current_user->user_login;
wp_register();
}
'
- '.wp_loginout().'
'; ?>
youlichika
Member
Posted 1 year ago #
This still can not show li tag...
<ul>
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
echo 'welcome '.$current_user->user_login';
wp_register();
}
'<li>'.wp_loginout().'</li>'; ?>
</ul>