PHP Forums Archive

Restrict the use of special characters in username

Tags: plugin, register, validation

fl00r posted on 2009-09-24 10:26:03 #

I would like to restrict the use of certain characters in the user name/displayname when people create an account.

Is this possible?

Comments / discussions

fl00r posted on 2009-09-24 10:44:51 #

I guess I need to edit the following line in register.php:

<input name="user_login" type="text" id="user_login" size="30" maxlength="30" value="<?php echo $user_login; ?>" />

?

Olaf posted on 2009-09-24 11:01:42 #

I thought that bbpress will filter these special characters, do you tried those characters during the registration?

fl00r posted on 2009-09-24 11:09:47 #

To be more specific: I don't want them to use dots and hyphens

Olaf posted on 2009-09-24 11:35:38 #

Than it's needed to use a validation function before you write the data to the database. I don't think that this is a standard function or plugin

fl00r posted on 2009-09-24 12:16:32 #

Can it be done with javascript?

Olaf posted on 2009-09-24 12:22:31 #

Sure that is possible but you need to include the code as well. I'm not sure if other client side script will break the current validation.

The whole registration process is currently not very good (think about what happens if the human test has failed, you need to re-enter all your details)

fl00r posted on 2009-09-24 12:34:50 #

Than it's needed to use a validation function before you write the data to the database. I don't think that this is a standard function or plugin

How do get this, presuming I am not a programmer?

Olaf posted on 2009-09-24 13:22:53 #

I will reply by mail.