. .
ShallHelp

×


| Home | home
| Consumers |
| Quote |
| Licensed Professionals |
| Clients |

| EXPLORE |
| Community / Forum |
| Articles / Blogs |
| Members Chat |

| MY ACCOUNT | person
| Sign In or Register |
| Missions |
| Tech Team |

2 thoughts on “Session: Oct. 5 2020, Monday

  1. Dug deeper into code.  I changed the settings in the WP Core files wp-includes > user . php : 

     

    /*
    * If a nicename is provided, remove unsafe user characters before using it.
    * Otherwise build a nicename from the user_login.
    */
    if ( ! empty( $userdata['user_nicename'] ) ) {
    $user_nicename = sanitize_user( $userdata['user_nicename'], true );
    if ( mb_strlen( $user_nicename ) > 50 ) {
    return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 50 characters.' ) );
    }
    } else {
    $user_nicename = mb_substr( $user_login, 0, 50 );
    }

    $user_nicename = sanitize_title( $user_nicename );

     

    AND

    /**
    * Filters a user's nicename before the user is created or updated.
    *
    * @since 2.0.3
    *
    * @param string $user_nicename The user's nicename.
    */
    $user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );

    $user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login ) );

    if ( $user_nicename_check ) {
    $suffix = 2;
    while ( $user_nicename_check ) {
    // user_nicename allows 12 chars. Subtract one for a hyphen, plus the length of the suffix.
    $base_length = 49 - mb_strlen( $suffix );
    $alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix";
    $user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login ) );
    $suffix++;
    }
    $user_nicename = $alt_user_nicename;
    }

     

    AND I changed from 60 to 12

     // user_login must be between 0 and 60 characters.
    if ( empty( $user_login ) ) {
    return new WP_Error( 'empty_user_login', __( 'Cannot create a user with an empty login name.' ) );
    } elseif ( mb_strlen( $user_login ) > 60 ) {
    return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 60 characters.' ) );
    }

     

    Will open registration real quick to see if the change works. 

  2. Forum registration has default 3 to 15 characters. Above that, it errors out. Good. 🙂

Comments are closed.