Enhanced Your WordPress Authentication


Sponsored Links




How To Enhancer Your WordPress authentication and added better handled and criteria. John Kolbert, one of WordPress developer create some tutorial how to do it. On this tutorial John Kolbert try to added same parameter and made own criteria…

WordPress Authentication - Miranda Kerr Black Leather

WordPress Authentication - Miranda Kerr Black Leather

John using add_filter method to create it. He tweak original function of wp_authenticate. On this example John add new parameter that will denied username bob.

First, Create custom function on functions.php and add_filter wp_authenticate with new function has created

add_filter( 'authenticate', 'my_custom_function', 10, 3 );
function my_custom_error_shake( $shake_codes ){
    $shake_codes[] = 'denied';
    return $shake_codes;
}

function my_custom_function( $user, $username, $password ){
    $user = get_userdatabylogin( $username );  //we don't really need this, but you might
    if( $username == 'bob'  ) {  //if the username is bob
        $user = new WP_Error( 'denied', __("<strong>ERROR</strong>: We do not allow people with the name Bob into this site") );
        remove_action('authenticate', 'wp_authenticate_username_password', 20);
        add_filter('shake_error_codes', 'my_custom_error_shake');	//make the login box shake
     }
     return $user;
}

That’s it’s, you can test it on your own WordPress and try to logging with username bob. Please note, you can replace bob with your own desire name. If you need more details about this tutorial you can leave comment on John Kolbert Tutorial

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net


2 Responses to Enhanced Your WordPress Authentication

  1. raiderhost says:

    nice tips pakde ,,,

    mantab di kasih di single ternyata :D

  2. Pingback: Extra Validation on WordPress Login : Seize the Chocolate

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>