Insensitive

Purpose

WordPress usernames are case-sensitive by default.

This is a great and friendly features that confuses the hell out of some users who got brainwashed into the other thinking by popular Internet sites. And so we keep getting irritated complaints along the lines of “Why cannot I log in? – I know how to spell my own name!” It gets worse once they realized that they actually do have trouble spelling the capitals…

To make things more confusing, when a user registered as “Joe” tries to log in as “joe”, he gets a misleading message: “Incorrect Password”, even if there is no such user as “joe”. It is a security feature, I understand, but it takes some digging to figure out that when the users complain about passwords, what they are actually having is a capitalization problem.

This “Insensitive” plug-in takes care of the problem.

System Requirements

Insensitive plug-in will only work with WordPress 2.0+ due to its usage of the “sanitize_user” filter.

Something is bugging me a bit: this plugin depends (among other things) on get_userdatabylogin function being case-insensitive. Why is get_userdatabylogin case-insensitive, which seems against current WordPress thinking. If thisever changes (due to a database overhaul?) this plug-in will stop working in some user creation scenarios.

All you have to do is install it (see installation section below, no surprises there).

  • There is nothing to configure.
  • There is no need to convert your existing usernames.
  • No PHP or CSS knowledge is required.

What it does, how it works

Once the plug-in is installed, your usernames will be treated in a case-insensitive manner.

For example:

  • if you have username “Joe“, the user can log in as “Joe“, “joe“, or “jOe
  • if you have username “joe“, the user can also log in as “Joe“, “joe“, or “jOe
  • if you create a user with username “Joe“, it will be recorded as “joe“. The “nice name” will not be affected.
  • if you already have a “Joe” and try to create a “JOE” (or a “jOE‘), you will get a “username already exists” error message.

Potential problem:

  • if you already have both Joe” and “joe” usernames, upon installation of this plug-in one of them will become inaccessible. I know, it is a rather insensitive behavior, but you have been warned, right? – Sorry, I just could not resist a bad pun. You can identify such cases by eyeballing your “Users & Roles” page – it is sorted by username.

Solution:

  • contact both users (do not play favorites!), ask them to pick different usernames.
  • Create a new username. When deleting an old one, assign all posts to the new username you just created.
  • Done.

If you have thousands upon thousands of registered users… write a conversion script. I do not think I am qualified for that. Sorry.

Shameless (but useful) Plug

Insensitive strives to minimize login problems. If you are thinking along these lines, you should really check out my Trim Passwords plugin – it takes care of the legion of people who cannot even copy/paste a password correctly.

Disclaimer

I wrote “Insensitive” for my own purposes, not for public distribution. It is provided “As Is” and can probably do horrible harm.

I do not know PHP. I have never written a full PHP program in my life. Not even “Hello, World”. This means the code may be buggy and is guaranteed to be sub-optimal.

If it works fine for you, please leave a comment here – it will encourage me and other potential users. Oh, and if you can make it better – go for it!
Download

Have you read the Disclaimer above??? – download Insensitive here: Insensitive plug-in for WordPress, version 1.0

Installation

  1. Download the plugin (see “Download” above).
  2. Rename insensitive.txt to insensitive.php and put it into your plugins directory (/wp-content/plugins/) or in a sub directory of the plugins directory.
  3. Activate the Plug-in.
  4. Enjoy!
  • There is nothing to configure.
  • There is no need to convert your existing usernames.
  • No PHP or CSS knowledge is required.

Thank you

Writing all this up took time and effort. If you happen to be actually using this plug-in – I appreciate your vote of confidence and would love to hear about it!

Got a problem? – Report it here!



  1. Any progress getting this to work? I’d love to use your plugin on my site.

  2. Version 1.0 is up, significantly re-written. It can conflict with some plug-ins (by design), since it uses a pluggable function (it’s a WordPress limitation), but given the nature of the function… let’s just say that I have not been able to find any conflicts yet.

  3. Great, I just installed it on my ITsVISTA blog. So far so good, I’ll let you know if I find any issues.

  4. Good karma!
    Thanks for your trust, Joe!
    BTW, I am no fan of Vista, but I have learned a few things about blog design just by looking at yours. Thx!

  5. hey, i just installed your plugin on my blog to fix the stupefying case-sensitivity issue for a user who just couldn’t get it… and it worked GREAT! took like 2 seconds to install…. although i got insensitive.txt instead of trim-passwords.txt like the instructions say but i figured that one out all by myself! 😉 jk. anyway.. thanks for this great plugin, and way to go for your 1st .PHP !! kudos!

  6. ok, ok.. so i looked around and now i see that this is not your 1st php script, but way to go anyways!

  7. Hey, it’s my fifth, so I totally appreciate all the cheers. Thanks! It does me a world of good to know that someone uses it!

  8. love it!

  9. Great plugin!

    Would it be possible to force nick first letter to uppercase?

  10. Everything is possible.
    Hey, make it YOUR first plugin! – Just take this code, find the right function in the PHP manual and stick it in.

    Before you know it, you will be a minor celebrity! 🙂

    I am not kidding: if I could do it – anyone can do it!

    A>

  11. Well, I’ve found the php function but I don’t know where I have to put it, unfortunately I’m not skilled enough.

  12. $string=’this is a much more simpler way to capitalise the first character of a string’;
    echo ucfirst($string); // This is a much more…

    1. That’s a clever answer to a tricky quetsion

  13. Buck, it would seem ucfirst() would belong in your plug-in where strtolower() is in mine…

    The only concern I would have is the pre-existing user names: how will they get converted to the capitalized version? (i boldly ignored that problem in my plug-in. you may choose to handle it manually too, although it is truly right)

  14. Hi andrabr;

    I think you need to convert to lowercase first and then first letter to uppercase but I’m not sure. I tried changing strtolower for ucfirst in line 42 and then in line 50 but it didn’t work; invalid username whenever I tried to register a new user.

    Regarding pre-existing user names I have not idea, perhaps with sql from phpmyadmin, nevertheless I’m lucky and I’m building a new site with no pre-existing users in the database.

  15. I have just installed your plugin on a new blog I am doing and first – thank you!

  16. Has anyone noticed if the activation of this plugin interferes with the TinyMCE editing toolbar on the write page? Preliminary testing on my site (which uses WP 2.3) suggests so (editing toolbar disappears when this plugin is activated), but I wanted to see if anyone else noticed.

  17. adam, I have only tested it in WP 2.0 so far. Please post here if you confirm the problem.

    Thx!

  18. Works great for me…hopefully this will reduce a lot of my support inquiries and lost password inquiries.

    thanks!
    –Corey

  19. […] Insensitive […]

  20. Sorry, but this plugin NOT compatible with WordPress 3.0!!! Please update your plugin, because if this active, then cannot login to WP!

Leave a comment


About

I am sorry you have to see this. Actually, I am not – if you came here, it’s you fault. When we choose our actions we also choose the consequences.

Despite my oversized ego I do NOT believe that anyone out there craves a daily dose of my insight. In fact, I am suspicious of people who think otherwise.

This blog is a tool.

I meddle with many complex computer deployments, and as I go through adding features and learning things, I also tend to forget numerous details and the reasoning behind the many choices I have made in the past. This is the place to document my adventures. And to give something back.

If you stumble upon this and find it useful – …good for you.