![]() |
AJAX: check if username exists on registration in realtime
It will be ported to vB 3.5 :)
The instructions are up-to-date (see post #8 for more information). Hello there! vB 3.5 is using AJAX for inline moderation and stuff like that. Pretty neat and why should we wait for something like this? :devious: What does this hack do? In the registration page it checks if the username the user has entered already exists. If this is true he will get a message instantly telling me to change the desired name. The submit button will also be disabled so that he can't finish the registration unless he has chosen another username which is not yet taken. Features: * can be turned off or on via the AdminCP * uses the vB phrases and can easily be translated * the user gets the error message without reloading the page * he/she can't complete the registration if the username is taken Do I need to be an expert to install this hack? No, not really.. You have to upload two files, edit one file, edit one template and add some custom CSS. Besides this there are 4 queries you need to run (see the point 'Warning:' for more information). Should be pretty easy and I'll support you as good as I can. Demo: You may take this for a test drive at my forums but please don't complete the registration unless you want to join my german community ;) http://www.pagodentreff.de/diskussio...m/register.php Just use 'dominik.h' as a username and see what happens. Problems? Is the new phrase not showing up? Read this: https://vborg.vbsupport.ru/showpost....5&postcount=19 Warning: This hack doesn't have an automatic installer. However you need to run 4 different queries for this hack to work. Those queries are for the settings in your AdminCP and for the phrases only. This hack won't affect your performance :) If you feel uncomfortable with running queries you may drop me a private message and I'll see what I can do for you. I will support this hack as good as I can but please keep your questions within this thread. Please don't forget to click install because you get an update notification and other nice things ;) The screenshot is taken from my translated version. This hack wouldn't be possible without the following article and the code: http://www.xml.com/pub/a/2005/02/09/...p-request.html |
it looks great! I'm gonna try this out. :D
|
/me was looking to code this same kind of ajax... great MRNase
|
hehe ;)
Please test it before you make it HOTM :D It worked for me and hopefully it'll work for you. |
You might want to credit xml.com for the AJAX JS code :)
|
[sql]INSERT INTO `phrase` (`phraseid`, `languageid`, `varname`, `text`, `phrasetypeid`) VALUES (NULL, '0', 'registererror', 'The username you have chosen is already taken', '5000', '39');[/sql] have an error, have to drop the '5000', in it...
EDIT: btw, would be good to duplicate this process for the change username in profile... ;) |
Quote:
[sql]INSERT INTO `phrase` (`phraseid`, `languageid`, `varname`, `text`, `phrasetypeid`) VALUES (NULL, '0', 'registererror', 'The username you have chosen is already taken', '', '39');[/sql] Dean C: Ok, I did that. This was my first static try http://validhtml.com/xmlhttprequest/. I just took the code from it without thinking much about it's source :nervous: nexialys: That's a good idea.. Iam going to sleep now but I'll keep that in mind for tomorrow :) |
MrNase,
I believe it should be: [sql]INSERT INTO `phrase` (`phraseid`, `languageid`, `varname`, `text`, `phrasetypeid`) VALUES (NULL, '0', 'registererror', 'The username you have chosen is already taken', '39');[/sql] |
oh, by the way -- great hack/find. :up:
There's a lot we can do with this. ;D |
Have you installed it and does it work for you?
I fixed the small error in the downloadable file.. It happened because I added the , '39' without thinking about the number of the affected rows (I tried to modify 6 where there are only 5 ;)). I added all phrases and settings manually so I couldn't test them. I hope they are working for you :rambo: |
yes, I installed it and it works as advertised.
I did run into the error but that was an easy fix. :) |
I have no use for this without a community of my own, but I'll click install anyways since it looks like a nice hack. Good job. :)
|
Oh very nice! I will test this out for you. :)
|
Ok, I'm pretty sure I followed the instructions 100%...but for some reason it will not display the text in the pink warning box.
Any clue what would cause this? Thanks! |
Ok, I'm pretty sure it has something to do with the SQL query. I ran both the one in the .txt file and the one princeton posted. Not sure why it isn't working. :ermm:
|
@MrNase: what would be best is to filter the username the same way it is filtered when the usual registration process occurs, because for now, it's not deleting spaces and illegal characters... anyway, this is the only thing i think to enhance... (would add a error like: your username contain illegal characters, etc...)
may be a good thing to add when users can posts when as guests (where we can add a username, the script would verify if you have a known username, and if yes, display the password field to berify...) anyway, i'm highly into enhancements... lol |
works fine here :)
|
Quote:
You must add it to the phrase-group 'register' (default would be GLOBAL, just select 'register' when adding it) because otherwise it doesn't work. The queries which are in the instruction is up-to-date. You don't need to run those which are suggested in this thread :) nexialys: That would only work if the JS-code is modified because by now it can only return true or false. Let's see if vB 3.5 has it in by default. If not the chances are good Iam releasing a hack that uses more AJAX :) |
If you are inserting phrases, you need to update the cache. Editing any phrase and then saving it without changing anything usually does the trick.
|
Quote:
|
Same for me but it worked without filling out the translation box :)
Iam not quite sure about the way the phrases work but I think the content of the first box is used if there's no translation. If there's a translation it will be used. |
I've got the same problem, But i'm getting this error
Runtime error, line 49 submit is null or not an object |
open the template register and search for:
PHP Code:
PHP Code:
The instructions are up-to-date :) |
Awesome, did the trick, sweet modification here
|
See if this one helps: https://vborg.vbsupport.ru/showpost....5&postcount=19 :)
If not follow this: https://vborg.vbsupport.ru/showpost....4&postcount=18 |
Yes sir, thank you very much
|
No problem. Iam glad its working now :)
(nice site btw. :)) |
This is a really nice little modification you have here..
Installed flawlessly. :) |
nice work :)
|
One question: Will that prevent non java users from registering?
|
No, this is failsafe.. Users without JS will see the default 'username already taken'-message when they submit the form :)
|
Thanks for quick answer. Just came from your site. This is a really useful hack.
|
Don't expect a fast reply from me within the next few hours.. Iam going to explain my girlfriend what AJAX really does ;) :D
vB is some kind of illness.. Once I started coding and stuff only my girlfriend gets me to sleep :ermm: |
What does this do? Maybe its me I couldnt work the demo (english) but unless I am missing something when a user picks a name that is already on my site they get an error message. what is this for exactly? Sorry I am just not sure what this is for.
|
it will save the user's time when submitting the form ..
eg. if they know that the username is already taken they will likely change it before submitting it |
Quote:
You know what would be HOT if that worked for email as well. myspace.com does this. (not the name) but the email address. Ohhhh even better. imagine it works with accounts you block as well? say I block AOL in the admincp bob puts bob@aol.com it tells him in advance. same for referals. if a user adds a referer and they dont exist the response is confusing for some. (try it) with this configured properly it could tell them that this user does not exist thus you cant use this name as a referer. Hummm might as well huck up the registration page fully! its the hard close on the sell right? If you guys do that... that would be insane. |
Does this add aa query with every key press, then?
|
yes it does (for every username--key)
|
Quote:
|
Well now, ain't this a beautiful thing!
Works great on 3.0.7 /me installs! |
All times are GMT. The time now is 02:14 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|