Answers for "wordpress username and password in database"

SQL
7

wordpress change user password sql

UPDATE `wp_users` SET `user_pass` = MD5( 'new_password' ) WHERE `wp_users`.`user_login` = "admin_username";
Posted by: Guest on March-31-2020
0

login with username password and another field wordpress

//create an extra field on your login page, you may use the login_form action hook
add_action('login_form','my_added_login_field');
function my_added_login_field(){
    //Output your HTML
?>
    <p>
        <label for="my_extra_field">My extra field<br>
        <input type="text" tabindex="20" size="20" value="" class="input" id="my_extra_field" name="my_extra_field_name"></label>
    </p>
<?php
}

/*Next we need to verify that what they entered into the field matched
what you have stored. In the following code, I've assumed you've stored
the identification code as a user meta value with meta key my_ident_code.
You should do this rather than create your own column!. See the Codex pages for
*/

add_filter( 'authenticate', 'my_custom_authenticate', 10, 3 );
function my_custom_authenticate( $user, $username, $password ){
    //Get POSTED value
    $my_value = $_POST['my_extra_field_name'];

    //Get user object
    $user = get_user_by('login', $username );

    //Get stored value
        $stored_value = get_user_meta($user->ID, 'my_ident_code', true);

    if(!$user || empty($my_value) || $my_value !=$stored_value){
        //User note found, or no value entered or doesn't match stored value - don't proceed.
            remove_action('authenticate', 'wp_authenticate_username_password', 20);
            remove_action('authenticate', 'wp_authenticate_email_password', 20); 

        //Create an error to return to user
            return new WP_Error( 'denied', __("<strong>ERROR</strong>: You're unique identifier was invalid.") );
    }

    //Make sure you return null 
    return null;
}
Posted by: Guest on September-29-2021

Code answers related to "wordpress username and password in database"

Code answers related to "SQL"

Browse Popular Code Answers by Language