Viewing 11 replies - 1 through 11 (of 11 total)
  • It’s just one line you have to change. Line 66 in network-username-restrictions-override.php change
    > Only lowercase letters (a-z) and numbers are allowed.
    to
    > Usernames can only contain lowercase letters (a-z) and numbers.

    Let’s see if we can contact the plugin’s owner to get the patch into this plugin … ?? (Just sent him a mail)

    Thread Starter Palpatine1976

    (@palpatine1976)

    Errr I don’t think changing the warning text will change the functionality ??

    The plugin itself doesn’t work because it no longer allows underscores (for example) even when that box is checked.

    Confirming, it’s broken. Any alternatives?

    Thread Starter Palpatine1976

    (@palpatine1976)

    I don’t know how to patch the plugin to make it work, but in my case I wrote my own validation function to check the characters in the username, then (knowing I had a valid username) just unset the error returned using the wpmu_validate_user_signup hook.

    https://codex.www.ads-software.com/Function_Reference/wpmu_validate_user_signup

    function twig_filter_wpmu_validate_user_signup( $userinfo ) {
    	if ( array_key_exists( 'errors', $userinfo ) ) {
    		unset( $userinfo['errors'] );
    	};
    	return $userinfo;
    }
    add_filter( 'wpmu_validate_user_signup', 'twig_filter_wpmu_validate_user_signup', 999 );

    If you are going to use my code snippet, just be sure to validate the username first, otherwise ANY username will be allowed, and that could cause problems down the line with WP core logic ??

    @theinfinity Thank you, this is the correct fix. I have modified your answer slightly to allow for backward compatibility:

    if ($message == __('Only lowercase letters (a-z) and numbers are allowed.') || $message == __('Usernames can only contain lowercase letters (a-z) and numbers.')) {

    Did you get any response from the plugin author?

    Here’s an alternative I just came across and implemented in this thread: Allow Uppercase Usernames in WP Network

    Works like a champ!

    Thread Starter Palpatine1976

    (@palpatine1976)

    @john_6x6

    That’s great for the lowercase restriction, but it won’t help the underscore or space restrictions ??

    Maybe there are other filters being applied, but I think it’s probably a regex, so this plugin should really be fixed to alter it correctly.

    Sith Lord Goz, thanks for clarifying that for me. I’m only interested in case.

    As unlikely as it sounds, @theinfinity is absolutely right.

    Even though, without context, it seems like that’s a silly change to make, once you look at the plugin code, you’ll realize it makes perfect sense.

    The problem is, the plugin uses the error message text to check to see which error was returned. In 4.4, it looks like that error message text changed, so the plugin’s test no longer passes.

    I can confirm @theinfinity’s fix works. Thanks for the reassurance @cgrymala, when I saw that the fix was to change an error string I brushed it off.

    TMS

    (@themysticalsock)

    Heya,

    May I suggest this:

    https://www.ads-software.com/plugins/username-changer/ to change usernames without dealing with MySQL

    Or possibly: https://www.ads-software.com/plugins/admin-renamer-extended/
    (more up to date)

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘No longer works in WP multisite 4.4’ is closed to new replies.