Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Forum: Plugins
    In reply to: Username in Hebrew

    To allow use with username Hebrew add this filter in functions.php file

    add_filter( 'sanitize_user', 'sanitize_user_with_hebrew', 10, 3 );
    
    function sanitize_user_with_hebrew( $username, $raw_username, $strict ) {
    
    	$username = $raw_username;
    	$username = wp_strip_all_tags( $username );
    	$username = remove_accents( $username );
    	// Kill octets
    	$username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
    	$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
    
    	// If strict, reduce to ASCII for max portability.
    	if ( $strict ) {
    		$username = preg_replace( '|[^a-z0-9?-? _.\-@]|i', '', $username );
    	}
    
    	$username = trim( $username );
    	// Consolidate contiguous whitespace
    	$username = preg_replace( '|\s+|', ' ', $username );
    
    	/**
    	 * Filter a sanitized username string.
    	 *
    	 * @since 2.0.1
    	 *
    	 * @param string $username     Sanitized username.
    	 * @param string $raw_username The username prior to sanitization.
    	 * @param bool   $strict       Whether to limit the sanitization to specific characters. Default false.
    	 */
    
    	return $username;
    }

    Forum: Plugins
    In reply to: Username in Hebrew

    this working very good
    maybe this not working because of must replace and few lines below after if ( $strict ) (line 1009)
    the problem is do not replace cod in file but with filter

Viewing 2 replies - 1 through 2 (of 2 total)