I’m using WP-Members to let new users register on my site. After they register I check their information and activate them, which emails them a password.

The password that WordPress generates is pretty complicated, e.g. v2Fj4S#b1Df(, but my users are older and I’d like to give them passwords which are a little more memorable, like bucket382potato.

Can I override the native password generator in WordPress to supply my own password scheme?

1 Answer
1

I figured it out. I created a plugin that adds a filter for random_password, like so:

function my_password_filter($input) {

    $words = explode(' ', "apple arm banana bike bird book chin clam class clover club corn crayon crow crown crowd crib desk dime dirt dress fang field flag flower fog game heat hill home horn hose joke juice kite lake maid mask mice milk mint meal meat moon mother morning name nest nose pear pen pencil plant rain river road rock room rose seed shape shoe shop show sink snail snake snow soda sofa star step stew stove straw string summer swing table tank team tent test toes tree vest water wing winter woman women");

    $num = rand(100, 999);

    return $words[array_rand($words)] . $num . $words[array_rand($words)];

}

add_filter('random_password', 'my_password_filter', 10, 1);

Tags:

Leave a Reply

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