\r
while(list($user_field,$user_field_data) = each($user_fields)) {\r
$user_field_content = formdata($user_field);\r
+ \r
+ if((!$user_field_data['optional']) && (!$user_field_content)) {\r
+ show_user_error($user_field_data['errors']['not_set']);\r
+ }\r
+ elseif($user_field_data['optional'] && (!$user_field_content)) {\r
+ $prepared_user_fields[$user_field_data['tpl_var']] = '';\r
+ continue;\r
+ }\r
\r
if(isset($user_field_data['check']) && $user_field_data['check'] != '') {\r
- if(function_exists($user_field_data['check']) && call_user_func($user_field_data['check'],$user_field_content)) {\r
+ if(function_exists($user_field_data['check']) && call_user_func($user_field_data['check'],$user_field_content) === false) {\r
show_user_error($user_field_data['errors']['check_fail']);\r
}\r
}\r
\r
if(isset($user_field_data['regex']) && $user_field_data['regex'] != '') {\r
- if(preg_match($user_field_data['regex'],$user_field_content)) {\r
+ if(!preg_match($user_field_data['regex'],$user_field_content)) {\r
show_user_error($user_field_data['errors']['match_fail']);\r
}\r
}\r