mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-10 18:54:08 +02:00
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
This commit is contained in:
@@ -383,6 +383,7 @@ class acp_profile
|
||||
$field_row = array_merge($default_values[$field_type], array(
|
||||
'field_ident' => str_replace(' ', '_', utf8_clean_string(request_var('field_ident', '', true))),
|
||||
'field_required' => 0,
|
||||
'field_show_novalue'=> 0,
|
||||
'field_hide' => 0,
|
||||
'field_show_profile'=> 0,
|
||||
'field_no_view' => 0,
|
||||
@@ -399,7 +400,7 @@ class acp_profile
|
||||
|
||||
// $exclude contains the data we gather in each step
|
||||
$exclude = array(
|
||||
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'),
|
||||
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view'),
|
||||
2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
|
||||
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
|
||||
);
|
||||
@@ -424,6 +425,7 @@ class acp_profile
|
||||
// Visibility Options...
|
||||
$visibility_ary = array(
|
||||
'field_required',
|
||||
'field_show_novalue',
|
||||
'field_show_on_reg',
|
||||
'field_show_on_pm',
|
||||
'field_show_on_vt',
|
||||
@@ -779,6 +781,7 @@ class acp_profile
|
||||
$template->assign_vars(array(
|
||||
'S_STEP_ONE' => true,
|
||||
'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false,
|
||||
'S_FIELD_SHOW_NOVALUE'=> ($cp->vars['field_show_novalue']) ? true : false,
|
||||
'S_SHOW_ON_REG' => ($cp->vars['field_show_on_reg']) ? true : false,
|
||||
'S_SHOW_ON_PM' => ($cp->vars['field_show_on_pm']) ? true : false,
|
||||
'S_SHOW_ON_VT' => ($cp->vars['field_show_on_vt']) ? true : false,
|
||||
@@ -1096,6 +1099,7 @@ class acp_profile
|
||||
'field_default_value' => $cp->vars['field_default_value'],
|
||||
'field_validation' => $cp->vars['field_validation'],
|
||||
'field_required' => $cp->vars['field_required'],
|
||||
'field_show_novalue' => $cp->vars['field_show_novalue'],
|
||||
'field_show_on_reg' => $cp->vars['field_show_on_reg'],
|
||||
'field_show_on_pm' => $cp->vars['field_show_on_pm'],
|
||||
'field_show_on_vt' => $cp->vars['field_show_on_vt'],
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user