How to Display "logged in" user information in wordpress

<?php global $current_user;
      get_currentuserinfo();

      echo 'Username: ' . $current_user->user_login . "\n";
      echo 'User email: ' . $current_user->user_email . "\n";
      echo 'User first name: ' . $current_user->user_firstname . "\n";
      echo 'User last name: ' . $current_user->user_lastname . "\n";
      echo 'User display name: ' . $current_user->display_name . "\n";
      echo 'User ID: ' . $current_user->ID . "\n";
?>
 
 
Login/Log out and redirect on same page 
 
<?php echo wp_logout_url( get_permalink() ); ?>
 
<?php echo wp_login_url( get_permalink() ); ?>
 
 

Comments

Popular posts from this blog

How Understanding Cloud Computing Saved a Million Dollars!

Some mistakes to avoid while looking for a job