Customizing the Login Form

e Login Form is your gateway to using and configuring the WordPress publishing platform. It controls access to to the Administration Screens, allowing only registered users to login.

Customizing the WordPress Login

<?php 
 // put this code in to the page where you can display the login form of wp
 $args = array(
  'echo'           => true,
  'remember'       => true,
  'redirect'       => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
  'form_id'        => 'loginform',
  'id_username'    => 'user_login',
  'id_password'    => 'user_pass',
  'id_remember'    => 'rememberme',
  'id_submit'      => 'wp-submit',
  'label_username' => __( 'Username' ),
  'label_password' => __( 'Password' ),
  'label_remember' => __( 'Remember Me' ),
  'label_log_in'   => __( 'Log In' ),
  'value_username' => '',
  'value_remember' => false
 );
?>
<?php wp_login_form($args); ?>

Get wordpress login user information

<?php 
 // access current user which are login using wp
 $current_user = wp_get_current_user(); 

?>
  
<?php echo 'Username: ' . $current_user->user_login . '<br />';
 echo 'User email: ' . $current_user->user_email . '<br />';
 echo 'User first name: ' . $current_user->user_firstname . '<br />';
 echo 'User last name: ' . $current_user->user_lastname . '<br />';
 echo 'User display name: ' . $current_user->display_name . '<br />';
 echo 'User ID: ' . $current_user->ID . '<br />'; 
 <?php wp_logout(); ?> 
?>

Share this

Related Posts

Previous
Next Post »