1

Topic: AJAX Username Check - taken names AND banned names

Hi all

This is my first mod.

I thought the existing AJAX username check was very nice by telling someone if a username was already taken when they enter it.

However, I thought it would be even better if it also checked against your custom banned usernames as well.

So this is what I did (vldpersonals 2.5.3):

Edit, hp.checkusername.php in /includes/hp

add on line 80 (just after existing username check):
        //------------------------------------------------
    // Check if username is banned - MOD BY MS
    //------------------------------------------------
    $usernames = array_map('trim', explode("\n", $PREFS->conf['banned_usernames']));
    if ( in_array($username, $usernames) )
    {
        die("error\n".$LANG['register']['username_taken']);
    }





I have decided (for the moment) to show the same error message as if it was taken, but you may decide to make another message.

Enjoy!

Last edited by idealists (2009-08-26 20:11:41)

2

Re: AJAX Username Check - taken names AND banned names

Oh darn, someone else has put that little tidbit in here already! I just realized yesterday that the program did not check 'banned usernames' until a new member actually submitted the form. Annoying at the very least.  I used the same little snippet from the lib.account_register.php file. Excellent!!

For those of you using 2.7, that is what I am using, and it works perfect!!

3

Re: AJAX Username Check - taken names AND banned names

[img]http://www.webbsupport.eu/image/thumb_up.gif[/img]