MyBB Community Forums

Full Version: Registering with Firstname_Lastname
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I am asking how I could set my forums, so the members will only be able to register with the username style:

Any suggestions?

Forums URL:
It was less work than I expected, so here it is:

In template "member_register" find line 135, which should be:
			maxlength: {$mybb->settings['maxnamelength']},

Insert after that a line with:

			usernameRules: true, 

Then find line (now?) 166 with:


Insert before that line:

   $.validator.addMethod("usernameRules", function(username) {return /[A-Z]+_[A-Z]/i.test(username)&&!(/\s/.test(username));},'{$lang->js_validator_username_underscore_noblanks}');

That takes care of the rule that there must be an underscore in the name and that spaces are not allowed.

For the corresponding error message add the following line to file /inc/languages/english/member.lang.php:

$l['js_validator_username_underscore_noblanks'] = 'The username must contain an underscore (_ but not on first or last position) and may not contain blanks.';

That should do the job (it has been tested). The template changes could easily be made as a plugin, but I do't think this is really necessary.
Thanks a lot!