diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-07-08 15:17:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-07-08 15:17:21 +0000 |
commit | bf42dddea7a20bd7a332d430dd2f361efd0141a6 (patch) | |
tree | 7bda5fdc005e8d73839f4783b7329813cfcd71dc | |
parent | 24600b8a43628e32ed273634ad094acd7d38a08c (diff) | |
download | brdo-bf42dddea7a20bd7a332d430dd2f361efd0141a6.tar.gz brdo-bf42dddea7a20bd7a332d430dd2f361efd0141a6.tar.bz2 |
- Usability improvement: users can also separate 'list items' (i.e. favorite
movies) using a comma. Only few users actually read the form description,
it seems ...
-rw-r--r-- | modules/profile.module | 16 | ||||
-rw-r--r-- | modules/profile/profile.module | 16 |
2 files changed, 14 insertions, 18 deletions
diff --git a/modules/profile.module b/modules/profile.module index 4b961c767..137e1a9b1 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -137,7 +137,7 @@ function profile_view_field($user, $field) { case 'url': return '<a href="'. check_url(strip_tags($value)) .'">'. strip_tags($value) .'</a>'; case 'list': - $values = split("[\n\r]", $value); + $values = split("[,\n\r]", $value); $fields = array(); foreach ($values as $value) { if ($value = trim(strip_tags($value))) { @@ -172,11 +172,7 @@ function _profile_form_explanation($field) { $output = $field->explanation; if ($field->type == 'list') { - $output .= ' '. t('Put each item on a separate line. No HTML allowed.'); - } - - if ($field->required) { - $output .= ' '. t('This is a required field.'); + $output .= ' '. t('Put each item on a separate line or separate them by commas. No HTML allowed.'); } if ($field->visibility == PROFILE_PRIVATE) { @@ -207,7 +203,7 @@ function profile_form_profile($edit, $user, $category) { break; case 'selection': $options = array('--'); - $lines = split("[\n\r]", $field->options); + $lines = split("[,\n\r]", $field->options); foreach ($lines as $line) { if ($line = trim($line)) { $options[$line] = $line; @@ -229,8 +225,10 @@ function profile_validate_profile($edit, $category) { while ($field = db_fetch_object($result)) { if ($edit[$field->name]) { - if ($field->type == 'url' && !valid_url($edit[$field->name], true)) { - form_set_error($field->name, t('The value provided for "%field" is not a valid URL.', array('%field' => $field->title))); + if ($field->type == 'url') { + if (!valid_url($edit[$field->name], true)) { + form_set_error($field->name, t('The value provided for "%field" is not a valid URL.', array('%field' => $field->title))); + } } } else if ($field->required && !user_access('administer users')) { diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 4b961c767..137e1a9b1 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -137,7 +137,7 @@ function profile_view_field($user, $field) { case 'url': return '<a href="'. check_url(strip_tags($value)) .'">'. strip_tags($value) .'</a>'; case 'list': - $values = split("[\n\r]", $value); + $values = split("[,\n\r]", $value); $fields = array(); foreach ($values as $value) { if ($value = trim(strip_tags($value))) { @@ -172,11 +172,7 @@ function _profile_form_explanation($field) { $output = $field->explanation; if ($field->type == 'list') { - $output .= ' '. t('Put each item on a separate line. No HTML allowed.'); - } - - if ($field->required) { - $output .= ' '. t('This is a required field.'); + $output .= ' '. t('Put each item on a separate line or separate them by commas. No HTML allowed.'); } if ($field->visibility == PROFILE_PRIVATE) { @@ -207,7 +203,7 @@ function profile_form_profile($edit, $user, $category) { break; case 'selection': $options = array('--'); - $lines = split("[\n\r]", $field->options); + $lines = split("[,\n\r]", $field->options); foreach ($lines as $line) { if ($line = trim($line)) { $options[$line] = $line; @@ -229,8 +225,10 @@ function profile_validate_profile($edit, $category) { while ($field = db_fetch_object($result)) { if ($edit[$field->name]) { - if ($field->type == 'url' && !valid_url($edit[$field->name], true)) { - form_set_error($field->name, t('The value provided for "%field" is not a valid URL.', array('%field' => $field->title))); + if ($field->type == 'url') { + if (!valid_url($edit[$field->name], true)) { + form_set_error($field->name, t('The value provided for "%field" is not a valid URL.', array('%field' => $field->title))); + } } } else if ($field->required && !user_access('administer users')) { |