Title: Function Reference/wp register
Last modified: August 20, 2016

---

# Function Reference/wp register

 *  [MountainTop](https://wordpress.org/support/users/mountaintop/)
 * (@mountaintop)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/function-referencewp-register/)
 * I’m a little confused on how to get the wp register working. I have the link 
   in the header of my site to register. After someone registers it changed to site
   admin no matter who they are. Is there a way to get it to display their username?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Harry](https://wordpress.org/support/users/harmck/)
 * (@harmck)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/function-referencewp-register/#post-2284102)
 * These will help:
 * [http://codex.wordpress.org/Function_Reference/is_user_logged_in](http://codex.wordpress.org/Function_Reference/is_user_logged_in)
 * To get the user details,
 * [http://codex.wordpress.org/Function_Reference/get_currentuserinfo](http://codex.wordpress.org/Function_Reference/get_currentuserinfo)
 *  Thread Starter [MountainTop](https://wordpress.org/support/users/mountaintop/)
 * (@mountaintop)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/function-referencewp-register/#post-2284109)
 * 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();}?
   >
 *  [Harry](https://wordpress.org/support/users/harmck/)
 * (@harmck)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/function-referencewp-register/#post-2284110)
 * 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](http://codex.wordpress.org/Function_Reference/get_currentuserinfo#Default_Usage)
 *  Thread Starter [MountainTop](https://wordpress.org/support/users/mountaintop/)
 * (@mountaintop)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/function-referencewp-register/#post-2284113)
 * Thanks. I read it, but I’m slowly understanding it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Function Reference/wp register’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [MountainTop](https://wordpress.org/support/users/mountaintop/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/function-referencewp-register/#post-2284113)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
