Need to remove * (special character) from random password generator
Feedback from iPhone users is that they cannot easily copy & paste the random generated password from their email into the login form because of how the iPhone copy function ignores *s (special characters). Therefore, we would like to turn the special characters off as part of the wp_generate_password function.
We already have some custom functions inside a child theme functions.php file. When we tried to paste in the following function, it crashed the site:
Code:
function wp_generate_password( $length = 12, $special_chars = false, $extra_special_chars = false ) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789';
if ( $special_chars )
$chars .= '01!@#$%^&*()';
if ( $extra_special_chars )
$chars .= '-_ []{}<>~`+=,.;:/?|';
$password = '';
for ( $i = 0; $i < $length; $i++ ) {
$password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
}
}
Any ideas why?
I got this code directly from the
WP Codex and changed just the following: 1- turned $special_chars = false (instead of trud) and 2- moved 0, 1 from $chars to the $special_chars area (because if someone is typing it in, those characters can be mistaken for O and l). I tried pasting this code into the functions.php file both before the other functions that are there and after, but neither worked.
Does it matter that the original code appears in a file called "pluggable.php" instead of "functions.php"?