WordPress.org

Support

Support » Themes and Templates » Printing Current User Name using PHP

Printing Current User Name using PHP

  • I gave it my best all day today and I still couldn’t make this php code work. Like the top dashboard information in the admin, I am trying to get it to print “Howdy, [current username] | Profile | Log Out” at the top of the screen in a <div>.

    It currently prints everything EXCEPT the current user’s name AND I can’t get it to recognize a new class with the “|” dividers.

    <span class="login_container">
    	         <?php global $user_ID;
                            if ($user_ID) {
                                echo "Howdy "; echo $user_identity; echo '<class="login_light">' . " | ";
                                } 
    
                            wp_register('<class="login">'); {echo " | ";}
    
    						if($user_ID) {
    							echo '<class="login"><a href="' . site_url('wp-login.php?action=logout', 'login') . '">' . __('Log Out', 'atahualpa') . '</a>';
    						} else {
    							echo '<class="login"><a href="' . site_url('wp-login.php', 'login') . '">' . __('Log In', 'atahualpa') . '</a>';
    						}
    		    ?>
    
    	    </span>

    Thanks for any help,
    Trimmode

  • The topic ‘Printing Current User Name using PHP’ is closed to new replies.