diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-07-26 16:12:21 +0200 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-07-26 16:12:21 +0200 |
commit | cec4c94f2edff43508f20d8838399f4114557134 (patch) | |
tree | a130a5bebdfb2d09de0de9293882ad74d6726333 /phpBB/includes/functions_profile_fields.php | |
parent | 8a264228d01215fe1020bf946fc95c804ba95450 (diff) | |
parent | d1e56868667234b4d8ea61a79463c3e3e47efa80 (diff) | |
download | forums-cec4c94f2edff43508f20d8838399f4114557134.tar forums-cec4c94f2edff43508f20d8838399f4114557134.tar.gz forums-cec4c94f2edff43508f20d8838399f4114557134.tar.bz2 forums-cec4c94f2edff43508f20d8838399f4114557134.tar.xz forums-cec4c94f2edff43508f20d8838399f4114557134.zip |
Merge remote-tracking branch 'upstream/develop' into feature/dic
* upstream/develop: (39 commits)
[ticket/11025] Add underline for hover to classes
[ticket/11025] Replace <b> with <strong> and/or class for semantic styling in subsilver2
[ticket/11025] Replace <b> with <strong> and/or class for semantic styling
[ticket/11025] Make last topic titles in forum list Bold
[prep-release-3.0.11] Update Changelog for 3.0.11-RC2 release.
[prep-release-3.0.11] Bumping version number for 3.0.11-RC2.
[ticket/10965] Profile data is only grabbed when show_novalue is enabled
[ticket/10965] Make sure all profile fields are always grabbed on viewtopic
[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
[ticket/10990] Changes for develop
[ticket/10990] Do not use comma separator when storing it as a log.
[ticket/10990] Use $user->lang['COMMA_SEPARATOR'] when appropriate
[ticket/10667] Fix tests under MySQL 5.5 strict mode (once again)
[ticket/10667] Fix tests under MySQL 5.5 strict mode (once again)
[ticket/11012] Fix php_ext change in mock_extension_manager
[ticket/11012] Normalize $phpEx member vars to $php_ext
[ticket/11002] Use translating option to rename the Etc/GMT options
[ticket/11009] Backport build.xml from develop to fix Bamboo Unit Testing.
[ticket/11008] Change onunload_functions to not use eval()
...
Diffstat (limited to 'phpBB/includes/functions_profile_fields.php')
-rw-r--r-- | phpBB/includes/functions_profile_fields.php | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 1c15ef897f..10af997bff 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']) @@ -455,6 +455,8 @@ class custom_profile $user_fields = array(); + $user_ids = $user_id; + // Go through the fields in correct order foreach (array_keys($this->profile_cache) as $used_ident) { @@ -463,6 +465,15 @@ class custom_profile $user_fields[$user_id][$used_ident]['value'] = $row['pf_' . $used_ident]; $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; } + + foreach ($user_ids as $user_id) + { + if (!isset($user_fields[$user_id][$used_ident]) && $this->profile_cache[$used_ident]['field_show_novalue']) + { + $user_fields[$user_id][$used_ident]['value'] = ''; + $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; + } + } } return $user_fields; @@ -520,7 +531,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 +540,7 @@ class custom_profile case 'string': case 'text': - if (!$value) + if (!$value && !$ident_ary['data']['field_show_novalue']) { return NULL; } @@ -547,7 +558,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 +584,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 +594,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 +615,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; |