diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-07-23 15:50:54 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-07-23 15:50:54 +0200 |
commit | 9480a5e5123518091055ddc8eb1bf137d8243eb0 (patch) | |
tree | fef3ed96d016e3123d84ec54a00eaeab6f285b66 /phpBB/includes/functions_profile_fields.php | |
parent | 147a125f69683f2f87017bf9870c804a9f09c3d3 (diff) | |
parent | 7b98e75ec3ab06d295834d5b48f85ad4b8744742 (diff) | |
download | forums-9480a5e5123518091055ddc8eb1bf137d8243eb0.tar forums-9480a5e5123518091055ddc8eb1bf137d8243eb0.tar.gz forums-9480a5e5123518091055ddc8eb1bf137d8243eb0.tar.bz2 forums-9480a5e5123518091055ddc8eb1bf137d8243eb0.tar.xz forums-9480a5e5123518091055ddc8eb1bf137d8243eb0.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10965] Database update was referring to 3.0.5 instead of 3.0.11-RC1
[ticket/10965] Introduce a new profile field option to display no value
Conflicts:
phpBB/includes/acp/acp_profile.php
Diffstat (limited to 'phpBB/includes/functions_profile_fields.php')
-rw-r--r-- | phpBB/includes/functions_profile_fields.php | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 1c15ef897f..a0093707a9 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -121,7 +121,7 @@ class custom_profile case FIELD_BOOL: $field_value = (bool) $field_value; - + if (!$field_value && $field_data['field_required']) { return 'FIELD_REQUIRED'; @@ -133,7 +133,7 @@ class custom_profile { return false; } - + $field_value = (int) $field_value; if ($field_value < $field_data['field_minlen']) @@ -520,7 +520,7 @@ class custom_profile switch ($this->profile_types[$field_type]) { case 'int': - if ($value === '') + if ($value === '' && !$ident_ary['data']['field_show_novalue']) { return NULL; } @@ -529,7 +529,7 @@ class custom_profile case 'string': case 'text': - if (!$value) + if (!$value && !$ident_ary['data']['field_show_novalue']) { return NULL; } @@ -547,7 +547,7 @@ class custom_profile $month = (isset($date[1])) ? (int) $date[1] : 0; $year = (isset($date[2])) ? (int) $date[2] : 0; - if (!$day && !$month && !$year) + if (!$day && !$month && !$year && !$ident_ary['data']['field_show_novalue']) { return NULL; } @@ -573,12 +573,7 @@ class custom_profile $this->get_option_lang($field_id, $lang_id, FIELD_DROPDOWN, false); } - // If a dropdown field is required, users - // cannot choose the "no value" option. - // They must choose one of the other options. - // Therefore, here we treat a value equal to - // the "no value" as a lack of value, i.e. NULL. - if ($value == $ident_ary['data']['field_novalue'] && $ident_ary['data']['field_required']) + if ($value == $ident_ary['data']['field_novalue'] && !$ident_ary['data']['field_show_novalue']) { return NULL; } @@ -588,7 +583,14 @@ class custom_profile // User not having a value assigned if (!isset($this->options_lang[$field_id][$lang_id][$value])) { - return NULL; + if ($ident_ary['data']['field_show_novalue']) + { + $value = $ident_ary['data']['field_novalue']; + } + else + { + return NULL; + } } return $this->options_lang[$field_id][$lang_id][$value]; @@ -602,6 +604,11 @@ class custom_profile $this->get_option_lang($field_id, $lang_id, FIELD_BOOL, false); } + if (!$value && $ident_ary['data']['field_show_novalue']) + { + $value = $ident_ary['data']['field_default_value']; + } + if ($ident_ary['data']['field_length'] == 1) { return (isset($this->options_lang[$field_id][$lang_id][(int) $value])) ? $this->options_lang[$field_id][$lang_id][(int) $value] : NULL; |