Last active
August 29, 2015 14:10
-
-
Save ooooak/b8f3679da6621059bbac to your computer and use it in GitHub Desktop.
[wordpress] Generate unique user name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function generate_username( $username ){ | |
return username_exists($username) | |
? admin_theme_user_manager::generate_username( | |
$username.mt_rand(1, 9) | |
.mt_rand(1, 9) | |
.mt_rand(1, 9) | |
.mt_rand(1, 9) | |
) | |
: $username ; | |
} | |
generate_username($username); | |
wp_generate_password(5, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment