• Resolved youlichika

    (@youlichika)


    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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(); ?>

    Thread Starter youlichika

    (@youlichika)

    @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>
    Thread Starter youlichika

    (@youlichika)

    <ul>
    <li><?php wp_register(); ?></li>
    <li><?php wp_loginout(); ?></li>
    </ul>
    Thread Starter youlichika

    (@youlichika)

    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().’
    • ‘; ?>

    Thread Starter youlichika

    (@youlichika)

    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>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to show user_name?’ is closed to new replies.