Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?php
  2. if ( ! is_user_logged_in() ) { // Display WordPress login form:
  3. $args = array(
  4. 'redirect' => admin_url(),
  5. 'form_id' => 'loginform-custom',
  6. 'label_username' => __( 'Username custom text' ),
  7. 'label_password' => __( 'Password custom text' ),
  8. 'label_remember' => __( 'Remember Me custom text' ),
  9. 'label_log_in' => __( 'Log In custom text' ),
  10. 'remember' => true
  11. );
  12. wp_login_form( $args );
  13. } else { // If logged in:
  14. wp_loginout( home_url() ); // Display "Log Out" link.
  15. echo " | ";
  16. wp_register('', ''); // Display "Site Admin" link.
  17. }
  18. ?>
  19.  
  20. function wp_authenticate($username, $password) {
  21. $username = sanitize_user($username);
  22. $password = trim($password);
  23.  
  24. $user = apply_filters('authenticate', null, $username, $password);
  25.  
  26. if ( $user == null ) {
  27. $user = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid username or incorrect password.'));
  28. }
  29.  
  30. $ignore_codes = array('empty_username', 'empty_password');
  31.  
  32. if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {
  33.  
  34. // Put your code here
  35.  
  36. }
  37.  
  38. return $user;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement