WordPress -How Retrieve Current User detail and logout link in your wordpress site

Hi Guys , You can retrieve any User Logged detail  on your site. follow just these steps given below.

  1. Take backup of your file before change on it

  2. Adde this code any where you want add this (i.e footer.php, header.php)

<div id=”menutop”>
 <p style=”text-align: right”><?php if ( is_user_logged_in() ) { ?>
  Welcome:
  <?php global $current_user;
            get_currentuserinfo();
            echo($current_user->user_firstname . ” ” . $current_user->user_lastname . “, “);
  ?>
  <a href=”<?php echo wp_logout_url(); ?>&redirect_to=/”>Logout</a>
 <?php } else { ?>
  You are not logged in –> <a href=”/wp-login.php?redirect_to=/”>Client Login</a>
 <?php } ?>
 </p>
</div>

Enjoy!

 

One Reply to “WordPress -How Retrieve Current User detail and logout link in your wordpress site”

  1. Hey There. I found your blog using msn. This is a very well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll definitely return.

Leave a Reply

Your email address will not be published. Required fields are marked *