i need the same password on woocommerce

Question

thanks for help me. Then, i have a problem, i have two functions, but i need apply the same random password on the functions.

this is the code, thanks 🙂

function changePassword($pass) {
       $password = date('Y');
        return $password;
}
add_filter('random_password', 'changePassword');

add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
    $mysqli = new mysqli('local', '', '', '');
    $password = date('Y');
    $sql = "DELETE users WHERE id = $user_id";
    $mysqli->query($sql);
    $sql = "INSERT INTO users (id, welcome, password) VALUES ($user_id, 0, '$password')";
    $mysqli->query($sql);
    $mysqli->close();

}
0
Ele 3 years 2020-06-04T03:10:18-05:00 0 Answers 67 views 0

Leave an answer

Browse
Browse