Last Update: 31 January 2012
A plugin to add a Regular Expression setting for a textbox Profile Fields.
The formatting check method used for this plugin uses XThreads Text Mask Filter method (I hope I don't misunderstand it
).
Please tell me if there is something wrong with the code. I'm still learning
So basically, it will work like the MyCodes? More protection? Will try.
For example, if you want your users fill a digit only in a profile fields, you can set the setting to ^\d+$
So, if they fill the profile fields with a non digit char, an error will be displayed.
Nice and logical - should be in stock
BTW, you might want to strip null chars when saving the expression, that is, replace
PHP Code:
$mn_pfaddsetting['mn_pfregex'] = $GLOBALS['db']->escape_string($GLOBALS['mybb']->input['mn_pfregex']);
|
with
PHP Code:
$mn_pfaddsetting['mn_pfregex'] = $GLOBALS['db']->escape_string(str_replace("\0", '', $GLOBALS['mybb']->input['mn_pfregex']));
|
IMO you shouldn't need to do this - blame PHP for that. Reason being that it's possible to artificially terminate the expression early, although, really, it's not much of an issue since only admins can exploit it.
Thanks for the fix, Yumi
I've updated the plugin.
Alright, But i found a bug, if there are any required fields other than email and password, and you fill a incorrect input for the field that uses a regex, you get a normal error but the required field go away, the problem is, that when you try and insert a now-valid input for the regex field, you get a error saying ¨X field value is missing¨ (not exactly the same but..)
.
Registration is working fine.
Sorry if you don-t get me, danm keyboar...
No no, the registration page is working 100% right.
The problem is in the edit profile page.
If there are any profile fields that are required and don´t use some regex, such field disappear after you submit a invalid profile field that require a regex field.
Still, I can't reproduce it:
[
attachment=687]
The 'Location' is a required fields, no regex.
The 'Color' is a non required fields, regex.
mmm, will check it in a clean board, my actual localhost is not so clean, maybe there is another plugin the one giving problems with this.