News:

Wondering if this will always be free?  See why free is better.

Main Menu

Registration Name Warning

Started by WittyUsername, February 16, 2012, 11:03:31 AM

Previous topic - Next topic

WittyUsername

This is a hard to find because I'm not exactly how to word it. I want to find away to inform members who register to the board that they can't have a certain word in their name. Due to the nature of the board and the sub-community of another website, that word is "Soup." As my name here is CannedSoup, on my board, if it was a new guy, he'd just be Canned.

Anyhow, I want to be able to warn them, I set the name to reserve, and tested the registration out, but all it does is say that the name is not available, doesn't tell them why. If I could perhaps write below the profile field in red-text "By default "Soup" is not allowed to be in your name" or something like that, it'd solve that problem.

Currently, I have an extra profile field in registration to warn them using a radio button, but  I feel that is ugly, and feels inefficient.

Any help would be great.

Suki

Admin 7 members / registration / Set Reserved Names

you can add that word there and your users won't be able to use that as their username/displayname
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

WittyUsername

Oh, I'm aware of that, that's not what I'm asking.

I'm wanting to warn my users that the name is reserved, it doesn't tell them that when they try, simply saying "Username is invalid" or something to that matter.

Suki

There is a setting in isReservedName()  to allow a fatal error with this text:

$txt['username_reserved'] = 'The username you tried to use contains the reserved name \'%1$s\'. Please try another username.';

on Sources/Register.php find:

$context['valid_username'] &= isReservedName($context['checked_username'], 0, false, false) ? 0 : 1;

and replace with:

$context['valid_username'] &= isReservedName($context['checked_username'], 0, false, true) ? 0 : 1;


always make a back up before doing any change.


I don't know how this change is gonna behave since $context['valid_username'] is looking for a boolean, this is just a wild guess.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

WittyUsername

Hmmm, that works well. Thank you.

Advertisement: