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!

 

Advertisements

Sr. Software Engineer

Posted in Wordpress
One comment on “WordPress -How Retrieve Current User detail and logout link in your wordpress site
  1. Habibi says:

    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. Ill definitely return.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: