PDA

View Full Version : Customizing Error Message During Registration


induslady
11-12-2013, 08:50 AM
Hello,

In the register page, in the field - "Username"
When one enters an already existing user name or special characters / space which is not allowed in the user name, it gives out error message -

$vbphrase[usernametaken] - That username is already in use or does not meet the administrator's standards. If you are {1} and you have forgotten your password, click <a href="login.php?{2}do=lostpw">here</a>.

But my requirement is that this error message should be customized such that -

1)For an already existing user name the error should be -
That username is already in use. If you are {1} and you have forgotten your password, click <a href="login.php?{2}do=lostpw">here</a>.

2)For special characters and space the error should be -
That username does not meet the administrator's standards.

Let me know how to do this? Thanks in advance.

kh99
11-12-2013, 10:12 PM
To do that I think you'd need to edit the file includes/class_dm_user.php, and find the occurrences of usernametaken. You could add a "translation" of the existing usernametaken to say what you want it to say when the user name is actually taken, then create a new phrase for "doesn't meet standards" and change the "usernametaken" to your new phrase variable in those cases.

tbworld
11-12-2013, 11:23 PM
To do that I think you'd need to edit the file includes/class_dm_user.php, and find the occurrences of usernametaken. You could add a "translation" of the existing usernametaken to say what you want it to say when the user name is actually taken, then create a new phrase for "doesn't meet standards" and change the "usernametaken" to your new phrase variable in those cases.

Nice thinking @kh99. :)

induslady
11-14-2013, 12:08 PM
To do that I think you'd need to edit the file includes/class_dm_user.php, and find the occurrences of usernametaken. You could add a "translation" of the existing usernametaken to say what you want it to say when the user name is actually taken, then create a new phrase for "doesn't meet standards" and change the "usernametaken" to your new phrase variable in those cases.

Hello kh99,

That was good and worked like a charm. Thanks for the response.

--------------- Added 1384434719 at 1384434719 ---------------

This is the solution that works -

1)Create a new Phrase - 'usernametaken_pregmatch' with suitable error message as per your requirement.
2)Edit Phrase - 'usernametaken' as per your requirement.
3) File in this path - /forum/includes/class_dm_user.php - find the text 'usernametaken' and in the instance of pregmatching update the error message to the newly created phrase name