when i register user in multisite if i want use Full name as username the system return error, because accept only lower case letter and accept only letter and number, and some time if the last name have whitespace (example “De Minicis”), the white space is a problem .
i have edit this function.
add_filter( 'gform_username' , 'auto_username', 10, 4 );
function auto_username( $username, $feed, $form, $entry ) {
GFCommon::log_debug( __METHOD__ . '(): running.' );
if($form['id'] === 4) {
$username = strtolower( rgar( $entry, '1.3' ) . rgar( $entry, '1.6' ) );
}
if ( empty( $username ) ) {
GFCommon::log_debug( __METHOD__ . '(): Value for username is empty.' );
return $username;
}
if ( ! function_exists( 'username_exists' ) ) {
require_once( ABSPATH . WPINC . '/registration.php' );
}
if ( username_exists( $username ) ) {
GFCommon::log_debug( __METHOD__ . '(): Username already exists, generating a new one.' );
$i = 2;
while ( username_exists( $username . $i ) ) {
$i++;
}
$username = $username . $i;
GFCommon::log_debug( __METHOD__ . '(): New username: ' . $username );
};
$search = array( '\\', "\0", "'", "\x8" /* BS */, "\n", "\r", "\t", "\x1A" /* Ctrl+Z */,"\x0B", " ", "\s" );
$username = str_replace($search,'',$username);
$username = strtolower($username);
return $username;
}
could you create such a default function in the add-on?