Results 1 to 1 of 1

Thread: Need to remove * (special character) from random password generator

  1. #1
    Thread Starter
    mione's Avatar
    Join Date
    Sep 2014
    Location
    United States
    Posts
    59
    Thanks
    33
    Thanked 3 Times in 3 Posts

    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"?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how to remove random post tab
    By whitecouncil in forum Report ClassiPress Bugs
    Replies: 7
    Last Post: January 20th, 2016, 08:02 AM
  2. Samcy Translation issues w/HTML special character entities
    By domino1957 in forum Report ClassiPress Bugs
    Replies: 7
    Last Post: June 24th, 2013, 01:16 PM
  3. [MOD NEEDED] Password Generator
    By facultyoc in forum JobRoller General Discussion
    Replies: 1
    Last Post: February 25th, 2013, 05:54 AM
  4. [SOLVED] remove coupon description character limit
    By mefindcoupon in forum Clipper General Discussion
    Replies: 3
    Last Post: November 3rd, 2012, 12:33 PM
  5. remove coupon description character limit
    By mefindcoupon in forum Report Clipper Bugs
    Replies: 1
    Last Post: November 2nd, 2012, 09:57 AM