Skip to:
Content
Pages
Categories
Search
Top
Bottom

usernames are case sensitive – how to make them case insensitive?

  • I migrated some users to bbPress and they are telling me that they get the following error when trying to login: User does not exist.

    It turns out bbPress user IDs are case sensitive, so if the ID in the database is

    Tipperary and the user types tipperary, it will not work.

    Any way to circumvent this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • OK. I’m thinking that I could somehow modify this function in functions.bb-users.php:

    function bb_get_user( $user_id, $args = null ) {
    global $wp_users_object;
    $user = $wp_users_object->get_user( $user_id, $args );
    if ( is_wp_error($user) )
    return false;
    return $user;
    }

    OK. I’m thinking that I could somehow modify this function in functions.bb-users.php:

    function bb_get_user( $user_id, $args = null ) {
    global $wp_users_object;
    $user = $wp_users_object->get_user( $user_id, $args );
    if ( is_wp_error($user) )
    return false;
    return $user;
    }

    ugh. this is tough.

    Just found this comment from mdawaffe on the WordPress development blog:

    mdawaffe 12:08 am on August 30, 2010 Permalink | Reply

    There’s some bugs in bbPress. In some places it treats user_logins case sensitively, and in others case insensitively (and sometimes it depends on your DB’s collation).

    http://wpdevel.wordpress.com/2010/08/27/i-upgraded-the-wp-org-plugins-directory/#comment-10009

    ugh. this is tough.

    Just found this comment from mdawaffe on the WordPress development blog:

    mdawaffe 12:08 am on August 30, 2010 Permalink | Reply

    There’s some bugs in bbPress. In some places it treats user_logins case sensitively, and in others case insensitively (and sometimes it depends on your DB’s collation).

    http://wpdevel.wordpress.com/2010/08/27/i-upgraded-the-wp-org-plugins-directory/#comment-10009

    OK… Here is my workaround for this problem:

    1. In functions.bp-pluggable.php, under:

    if ( !bb_get_option( 'email_login' ) || false === strpos( $user, '@' ) ) { // user_login

    Add:

    $user = strtolower($user);

    2. In class.wp-user.php, under:

    $display_name = $user_login;

    Add:

    $user_login = strtolower($user_login);

    Voila – CaSe InseNSitIvity! Note that the placement of the strtolower() functions is important and allows the user to retain Case Sensitivity in their display_name (while changing their user_login to lowercase). I haven’t seen any untoward side effects yet, but will let you know.

    Nice talking to me!

    OK… Here is my workaround for this problem:

    1. In functions.bp-pluggable.php, under:

    if ( !bb_get_option( 'email_login' ) || false === strpos( $user, '@' ) ) { // user_login

    Add:

    $user = strtolower($user);

    2. In class.wp-user.php, under:

    $display_name = $user_login;

    Add:

    $user_login = strtolower($user_login);

    Voila – CaSe InseNSitIvity! Note that the placement of the strtolower() functions is important and allows the user to retain Case Sensitivity in their display_name (while changing their user_login to lowercase). I haven’t seen any untoward side effects yet, but will let you know.

    Nice talking to me!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar