diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-04-29 20:31:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-04-29 20:31:21 +0000 |
commit | 5ce6e015d0d8d080927c65a4cf692577c059b65c (patch) | |
tree | 2d82aa6590dfcc02c395679a1ca045094e8bf5ca | |
parent | db046504117867ebc2454d856f562bbe30bbe48b (diff) | |
download | brdo-5ce6e015d0d8d080927c65a4cf692577c059b65c.tar.gz brdo-5ce6e015d0d8d080927c65a4cf692577c059b65c.tar.bz2 |
- Fixes bug #1336 and #1473.
-rw-r--r-- | modules/profile.module | 13 | ||||
-rw-r--r-- | modules/profile/profile.module | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/modules/profile.module b/modules/profile.module index c5d044290..617366548 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -52,11 +52,11 @@ function profile_settings() { $profile_register_fields = variable_get("profile_register_fields", array()); $output = "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; - $output .= "<tr><th>field</th><th>public</th><th>private</th><th>required</th><th>show in registration form</th></tr>\n"; + $output .= "<tr><th>field</th><th>enable</th><th>public</th><th>required</th><th>show in registration form</th></tr>\n"; foreach ($profile_fields as $key => $field) { $output .= "<tr><td>$field[1]</td>"; - $output .= "<td align=\"center\">". form_checkbox("", "profile_public_fields][", $key, in_array($key, $profile_public_fields)) ."</td>"; $output .= "<td align=\"center\">". form_checkbox("", "profile_private_fields][", $key, in_array($key, $profile_private_fields)) ."</td>"; + $output .= "<td align=\"center\">". form_checkbox("", "profile_public_fields][", $key, in_array($key, $profile_public_fields)) ."</td>"; $output .= "<td align=\"center\">". form_checkbox("", "profile_required_fields][", $key, in_array($key, $profile_required_fields)) ."</td>"; $output .= "<td align=\"center\">". form_checkbox("", "profile_register_fields][", $key, in_array($key, $profile_register_fields)) ."</td>"; $output .= "</tr>\n"; @@ -135,15 +135,16 @@ function _profile_form($edit, $mode) { } function _profile_validate($edit, $mode) { + global $profile_fields, $user, $HTTP_POST_VARS; - $req_fields = _profile_active_fields($mode); + $enabled_fields = _profile_active_fields($mode); - if (in_array("birthday", $req_fields) && ($birth_error = _profile_validate_birth($edit))) { + if (in_array("birthday", $enabled_fields) && ($birth_error = _profile_validate_birth($edit))) { $error .= $birth_error."<br />"; } - if (in_array("avatar", $req_fields) && ($avatar_error = _profile_validate_avatar($edit))) { + if (in_array("avatar", $enabled_fields) && ($avatar_error = _profile_validate_avatar($edit))) { $error .= $avatar_error."<br />"; } @@ -156,7 +157,7 @@ function _profile_validate($edit, $mode) { // now check for required fields foreach(_profile_active_fields("required") as $required) { - if (in_array($required, $req_fields)) { + if (in_array($required, $enabled_fields)) { if (!$edit["profile_".$required]) { $error .= t("This required field is missing: %a", array("%a" => $profile_fields[$required][1]))."<br />"; } diff --git a/modules/profile/profile.module b/modules/profile/profile.module index c5d044290..617366548 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -52,11 +52,11 @@ function profile_settings() { $profile_register_fields = variable_get("profile_register_fields", array()); $output = "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; - $output .= "<tr><th>field</th><th>public</th><th>private</th><th>required</th><th>show in registration form</th></tr>\n"; + $output .= "<tr><th>field</th><th>enable</th><th>public</th><th>required</th><th>show in registration form</th></tr>\n"; foreach ($profile_fields as $key => $field) { $output .= "<tr><td>$field[1]</td>"; - $output .= "<td align=\"center\">". form_checkbox("", "profile_public_fields][", $key, in_array($key, $profile_public_fields)) ."</td>"; $output .= "<td align=\"center\">". form_checkbox("", "profile_private_fields][", $key, in_array($key, $profile_private_fields)) ."</td>"; + $output .= "<td align=\"center\">". form_checkbox("", "profile_public_fields][", $key, in_array($key, $profile_public_fields)) ."</td>"; $output .= "<td align=\"center\">". form_checkbox("", "profile_required_fields][", $key, in_array($key, $profile_required_fields)) ."</td>"; $output .= "<td align=\"center\">". form_checkbox("", "profile_register_fields][", $key, in_array($key, $profile_register_fields)) ."</td>"; $output .= "</tr>\n"; @@ -135,15 +135,16 @@ function _profile_form($edit, $mode) { } function _profile_validate($edit, $mode) { + global $profile_fields, $user, $HTTP_POST_VARS; - $req_fields = _profile_active_fields($mode); + $enabled_fields = _profile_active_fields($mode); - if (in_array("birthday", $req_fields) && ($birth_error = _profile_validate_birth($edit))) { + if (in_array("birthday", $enabled_fields) && ($birth_error = _profile_validate_birth($edit))) { $error .= $birth_error."<br />"; } - if (in_array("avatar", $req_fields) && ($avatar_error = _profile_validate_avatar($edit))) { + if (in_array("avatar", $enabled_fields) && ($avatar_error = _profile_validate_avatar($edit))) { $error .= $avatar_error."<br />"; } @@ -156,7 +157,7 @@ function _profile_validate($edit, $mode) { // now check for required fields foreach(_profile_active_fields("required") as $required) { - if (in_array($required, $req_fields)) { + if (in_array($required, $enabled_fields)) { if (!$edit["profile_".$required]) { $error .= t("This required field is missing: %a", array("%a" => $profile_fields[$required][1]))."<br />"; } |