aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-11-26 19:58:35 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-11-26 19:58:35 +0000
commitfb77cdd0513994dca478c06a3c9ac5912da07872 (patch)
tree722500e2be300938c98f48fe8c2546db24cce96d /phpBB
parent63b089f6535cf53ec8bec87decf56caab30bd0ad (diff)
downloadforums-fb77cdd0513994dca478c06a3c9ac5912da07872.tar
forums-fb77cdd0513994dca478c06a3c9ac5912da07872.tar.gz
forums-fb77cdd0513994dca478c06a3c9ac5912da07872.tar.bz2
forums-fb77cdd0513994dca478c06a3c9ac5912da07872.tar.xz
forums-fb77cdd0513994dca478c06a3c9ac5912da07872.zip
Better handling and finer control for custom profile fields visibility options. (Patch by Highway of Life)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9127 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/acp_profile.html10
-rw-r--r--phpBB/develop/create_schema_files.php1
-rw-r--r--phpBB/develop/mysql_upgrader.php9
-rw-r--r--phpBB/docs/CHANGELOG.html3
-rw-r--r--phpBB/includes/acp/acp_profile.php100
-rw-r--r--phpBB/includes/functions_profile_fields.php42
-rw-r--r--phpBB/install/database_update.php52
-rw-r--r--phpBB/install/schemas/firebird_schema.sql1
-rw-r--r--phpBB/install/schemas/mssql_schema.sql1
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql1
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql1
-rw-r--r--phpBB/install/schemas/oracle_schema.sql1
-rw-r--r--phpBB/install/schemas/postgres_schema.sql3
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql3
-rw-r--r--phpBB/language/en/acp/profile.php14
15 files changed, 150 insertions, 92 deletions
diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html
index eec975ad25..a2dcc4ebbd 100644
--- a/phpBB/adm/style/acp_profile.html
+++ b/phpBB/adm/style/acp_profile.html
@@ -48,20 +48,20 @@
<fieldset>
<legend>{L_VISIBILITY_OPTION}</legend>
<dl>
- <dt><label for="field_option_none">{L_DISPLAY_AT_PROFILE}:</label><br /><span>{L_DISPLAY_AT_PROFILE_EXPLAIN}</span></dt>
- <dd><input type="radio" class="radio" id="field_option_none" name="field_option" value="none"<!-- IF not S_SHOW_ON_REG and not S_FIELD_REQUIRED and not S_FIELD_HIDE --> checked="checked"<!-- ENDIF --> /></dd>
+ <dt><label for="field_show_profile">{L_DISPLAY_AT_PROFILE}:</label><br /><span>{L_DISPLAY_AT_PROFILE_EXPLAIN}</span></dt>
+ <dd><input type="checkbox" class="radio" id="field_show_profile" name="field_show_profile" value="1"<!-- IF S_SHOW_PROFILE --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
<dl>
<dt><label for="field_show_on_reg">{L_DISPLAY_AT_REGISTER}:</label><br /><span>{L_DISPLAY_AT_REGISTER_EXPLAIN}</span></dt>
- <dd><input type="radio" class="radio" id="field_show_on_reg" name="field_option" value="field_show_on_reg"<!-- IF S_SHOW_ON_REG --> checked="checked"<!-- ENDIF --> /></dd>
+ <dd><input type="checkbox" class="radio" id="field_show_on_reg" name="field_show_on_reg" value="1"<!-- IF S_SHOW_ON_REG --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
<dl>
<dt><label for="field_required">{L_REQUIRED_FIELD}:</label><br /><span>{L_REQUIRED_FIELD_EXPLAIN}</span></dt>
- <dd><input type="radio" class="radio" id="field_required" name="field_option" value="field_required"<!-- IF S_FIELD_REQUIRED --> checked="checked"<!-- ENDIF --> /></dd>
+ <dd><input type="checkbox" class="radio" id="field_required" name="field_required" value="1"<!-- IF S_FIELD_REQUIRED --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
<dl>
<dt><label for="field_hide">{L_HIDE_PROFILE_FIELD}:</label><br /><span>{L_HIDE_PROFILE_FIELD_EXPLAIN}</span></dt>
- <dd><input type="radio" class="radio" id="field_hide" name="field_option" value="field_hide"<!-- IF S_FIELD_HIDE --> checked="checked"<!-- ENDIF --> /></dd>
+ <dd><input type="checkbox" class="radio" id="field_hide" name="field_hide" value="1"<!-- IF S_FIELD_HIDE --> checked="checked"<!-- ENDIF --> /></dd>
</dl>
</fieldset>
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 3c8e5275a0..32b9eceb6c 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1404,6 +1404,7 @@ function get_schema_struct()
'field_validation' => array('VCHAR_UNI:20', ''),
'field_required' => array('BOOL', 0),
'field_show_on_reg' => array('BOOL', 0),
+ 'field_show_profile' => array('BOOL', 0),
'field_hide' => array('BOOL', 0),
'field_no_view' => array('BOOL', 0),
'field_active' => array('BOOL', 0),
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
index 82fbfb09eb..752cb9ac5b 100644
--- a/phpBB/develop/mysql_upgrader.php
+++ b/phpBB/develop/mysql_upgrader.php
@@ -1,10 +1,10 @@
<?php
-/**
+/**
*
* @package phpBB3
* @version $Id$
-* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @copyright (c) 2006 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This file creates SQL statements to upgrade phpBB on MySQL 3.x/4.0.x to 4.1.x/5.x
*
@@ -127,7 +127,7 @@ foreach ($schema_data as $table_name => $table_data)
$line = "ALTER TABLE {$table_name} $newline";
// Table specific so we don't get overlap
- $modded_array = array();
+ $modded_array = array();
// Write columns one by one...
foreach ($table_data['COLUMNS'] as $column_name => $column_data)
@@ -876,6 +876,7 @@ function get_schema_struct()
'field_validation' => array('VCHAR_UNI:20', ''),
'field_required' => array('BOOL', 0),
'field_show_on_reg' => array('BOOL', 0),
+ 'field_show_profile' => array('BOOL', 0),
'field_hide' => array('BOOL', 0),
'field_no_view' => array('BOOL', 0),
'field_active' => array('BOOL', 0),
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 221a255390..c83bd2cc72 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -95,9 +95,10 @@
<li>[Fix] Only display special ranks to guests; no longer display normal ranks for guests (Bug #36735)</li>
<li>[Fix] Properly treat punctuation marks after local urls (Bug #37055)</li>
<li>[Fix] Make searching for members by YIM address work in prosilver</li>
+ <li>[Fix] Tell users to recreate the search index after changing the common word threshold for fulltext_native (Bug #36345)</li>
<li>[Change] Alllow applications to set custom module inclusion path (idea by HoL)</li>
<li>[Change] Handle checking for duplicate usernames in chunks (Bug #17285 - Patch by A_Jelly_Doughnut)</li>
- <li>[Fix] Tell users to recreate the search index after changing the common word threshold for fulltext_native (Bug #36345)</li>
+ <li>[Change] Better handling and finer control for custom profile fields visibility options. (Patch by Highway of Life)</li>
</ul>
<a name="v302"></a><h3>1.ii. Changes since 3.0.2</h3>
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 309f5d5e74..7ab6ff7cd6 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -77,7 +77,7 @@ class acp_profile
FROM ' . PROFILE_LANG_TABLE . '
ORDER BY lang_id';
$result = $db->sql_query($sql);
-
+
while ($row = $db->sql_fetchrow($result))
{
// Which languages are available for each item
@@ -206,7 +206,7 @@ class acp_profile
'field_id' => $field_id,
)));
}
-
+
break;
case 'activate':
@@ -216,7 +216,7 @@ class acp_profile
{
trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'";
@@ -253,7 +253,7 @@ class acp_profile
{
trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
SET field_active = 0
WHERE field_id = $field_id";
@@ -285,7 +285,7 @@ class acp_profile
case 'create':
case 'edit':
-
+
$field_id = request_var('field_id', 0);
$step = request_var('step', 1);
@@ -354,18 +354,19 @@ class acp_profile
{
// We are adding a new field, define basic params
$lang_options = $field_row = array();
-
+
$field_type = request_var('field_type', 0);
-
+
if (!$field_type)
{
trigger_error($user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$field_row = array_merge($default_values[$field_type], array(
- 'field_ident' => utf8_clean_string(request_var('field_ident', '', true)),
+ 'field_ident' => str_replace(' ', '_', utf8_clean_string(request_var('field_ident', '', true))),
'field_required' => 0,
'field_hide' => 0,
+ 'field_show_profile'=> 0,
'field_no_view' => 0,
'field_show_on_reg' => 0,
'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)),
@@ -378,7 +379,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', 'field_no_view'),
+ 1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_required', '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')
);
@@ -400,25 +401,20 @@ class acp_profile
$cp->vars['lang_explain'] = utf8_normalize_nfc(request_var('lang_explain', $field_row['lang_explain'], true));
$cp->vars['lang_default_value'] = utf8_normalize_nfc(request_var('lang_default_value', $field_row['lang_default_value'], true));
- // Field option...
- if (isset($_REQUEST['field_option']))
- {
- $field_option = request_var('field_option', '');
+ // Visibility Options...
+ $visibility_ary = array(
+ 'field_required',
+ 'field_show_on_reg',
+ 'field_show_profile',
+ 'field_hide',
+ );
- $cp->vars['field_required'] = ($field_option == 'field_required') ? 1 : 0;
- $cp->vars['field_show_on_reg'] = ($field_option == 'field_show_on_reg') ? 1 : 0;
- $cp->vars['field_hide'] = ($field_option == 'field_hide') ? 1 : 0;
- }
- else
+ foreach ($visibility_ary as $val)
{
- $cp->vars['field_required'] = $field_row['field_required'];
- $cp->vars['field_show_on_reg'] = $field_row['field_show_on_reg'];
- $cp->vars['field_hide'] = $field_row['field_hide'];
-
- $field_option = ($field_row['field_required']) ? 'field_required' : (($field_row['field_show_on_reg']) ? 'field_show_on_reg' : (($field_row['field_hide']) ? 'field_hide' : ''));
+ $cp->vars[$val] = ($submit || $save) ? request_var($val, 0) : $field_row[$val];
}
- $cp->vars['field_no_view'] = request_var('field_no_view', $field_row['field_no_view']);
+ $cp->vars['field_no_view'] = request_var('field_no_view', (int) $field_row['field_no_view']);
// A boolean field expects an array as the lang options
if ($field_type == FIELD_BOOL)
@@ -481,7 +477,7 @@ class acp_profile
else if ($field_type == FIELD_DATE && $key == 'field_default_value')
{
$always_now = request_var('always_now', -1);
-
+
if ($always_now == 1 || ($always_now === -1 && $var == 'now'))
{
$now = getdate();
@@ -504,7 +500,7 @@ class acp_profile
{
list($cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']) = explode('-', $var);
}
- }
+ }
}
/* else if ($field_type == FIELD_BOOL && $key == 'field_default_value')
{
@@ -533,7 +529,7 @@ class acp_profile
}
$db->sql_freeresult($result);
-
+
$sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value
FROM ' . PROFILE_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
@@ -550,7 +546,7 @@ class acp_profile
}
$db->sql_freeresult($result);
}
-
+
foreach ($exclude[3] as $key)
{
$cp->vars[$key] = utf8_normalize_nfc(request_var($key, array(0 => ''), true));
@@ -569,7 +565,7 @@ class acp_profile
{
$cp->vars[$key][$lang_id] = explode("\n", $options);
}
-
+
}
}
@@ -709,7 +705,7 @@ class acp_profile
'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)],
'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)],
-
+
'U_ACTION' => $this->u_action . "&amp;action=$action&amp;step=$step",
'U_BACK' => $this->u_action)
);
@@ -719,13 +715,14 @@ class acp_profile
{
// Create basic options - only small differences between field types
case 1:
-
+
// Build common create options
$template->assign_vars(array(
'S_STEP_ONE' => true,
'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false,
'S_SHOW_ON_REG' => ($cp->vars['field_show_on_reg']) ? true : false,
'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false,
+ 'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false,
'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false,
'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']),
@@ -746,7 +743,7 @@ class acp_profile
'LANG_DEFAULT_VALUE' => $cp->vars['lang_default_value'])
);
}
-
+
if ($field_type == FIELD_BOOL || $field_type == FIELD_DROPDOWN)
{
// Initialize these array elements if we are creating a new field
@@ -775,11 +772,11 @@ class acp_profile
'SECOND_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][1] : '')
);
}
-
+
break;
case 2:
-
+
$template->assign_vars(array(
'S_STEP_TWO' => true,
'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS'])
@@ -817,7 +814,7 @@ class acp_profile
);
}
}
-
+
break;
}
@@ -829,7 +826,7 @@ class acp_profile
break;
}
-
+
$sql = 'SELECT *
FROM ' . PROFILE_FIELDS_TABLE . '
ORDER BY field_order';
@@ -905,14 +902,14 @@ class acp_profile
$languages[$row['lang_id']] = $row['lang_iso'];
}
$db->sql_freeresult($result);
-
+
$options = array();
$options['lang_name'] = 'string';
if ($cp->vars['lang_explain'])
{
$options['lang_explain'] = 'text';
}
-
+
switch ($field_type)
{
case FIELD_BOOL:
@@ -922,7 +919,7 @@ class acp_profile
case FIELD_DROPDOWN:
$options['lang_options'] = 'optionfield';
break;
-
+
case FIELD_TEXT:
case FIELD_STRING:
if ($cp->vars['lang_default_value'])
@@ -931,7 +928,7 @@ class acp_profile
}
break;
}
-
+
$lang_options = array();
foreach ($options as $field => $field_type)
@@ -957,7 +954,7 @@ class acp_profile
if ($field == 'lang_options')
{
$var = (!isset($cp->vars['l_lang_options'][$lang_id]) || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['lang_options'] : $cp->vars['l_lang_options'][$lang_id];
-
+
switch ($field_type)
{
case 'two_options':
@@ -978,7 +975,7 @@ class acp_profile
);
break;
}
-
+
if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN']))
{
$lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
@@ -992,7 +989,7 @@ class acp_profile
'TITLE' => $user->lang['CP_' . strtoupper($field)],
'FIELD' => ($field_type == 'string') ? '<dd><input class="medium" type="text" name="l_' . $field . '[' . $lang_id . ']" value="' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '" /></dd>' : '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="3" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea></dd>'
);
-
+
if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN']))
{
$lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
@@ -1040,6 +1037,7 @@ class acp_profile
'field_required' => $cp->vars['field_required'],
'field_show_on_reg' => $cp->vars['field_show_on_reg'],
'field_hide' => $cp->vars['field_hide'],
+ 'field_show_profile' => $cp->vars['field_show_profile'],
'field_no_view' => $cp->vars['field_no_view']
);
@@ -1065,7 +1063,7 @@ class acp_profile
WHERE field_id = $field_id";
$db->sql_query($sql);
}
-
+
if ($action == 'create')
{
$field_ident = 'pf_' . $field_ident;
@@ -1082,7 +1080,7 @@ class acp_profile
{
$sql_ary['field_id'] = $field_id;
$sql_ary['lang_id'] = $default_lang_id;
-
+
$profile_sql[] = 'INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
}
else
@@ -1155,7 +1153,7 @@ class acp_profile
AND lang_id = " . (int) $default_lang_id;
$db->sql_query($sql);
}
-
+
foreach ($cp->vars['lang_options'] as $option_id => $value)
{
$sql_ary = array(
@@ -1258,7 +1256,7 @@ class acp_profile
$lang_id = $sql['lang_id'];
$option_id = $sql['option_id'];
unset($sql['lang_id'], $sql['field_id'], $sql['option_id']);
-
+
$this->update_insert(PROFILE_FIELDS_LANG_TABLE, $sql, array(
'lang_id' => $lang_id,
'field_id' => $field_id,
@@ -1278,7 +1276,7 @@ class acp_profile
$db->sql_query($sql);
}
}
-
+
$db->sql_transaction('commit');
if ($action == 'edit')
@@ -1324,7 +1322,7 @@ class acp_profile
if (!$row)
{
$sql_ary = array_merge($where_fields, $sql_ary);
-
+
if (sizeof($sql_ary))
{
$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql_ary));
@@ -1376,7 +1374,7 @@ class acp_profile
case FIELD_BOOL:
$sql .= 'TINYINT(2) ';
break;
-
+
case FIELD_DROPDOWN:
$sql .= 'MEDIUMINT(8) ';
break;
@@ -1612,4 +1610,4 @@ class acp_profile
}
}
-?> \ No newline at end of file
+?>
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index b621095df4..cc59648e54 100644
--- a/phpBB/includes/functions_profile_fields.php
+++ b/phpBB/includes/functions_profile_fields.php
@@ -40,14 +40,14 @@ class custom_profile
{
case 'register':
// If the field is required we show it on the registration page and do not show hidden fields
- $sql_where .= ' AND (f.field_show_on_reg = 1 OR f.field_required = 1) AND f.field_hide = 0';
+ $sql_where .= ' AND f.field_show_on_reg = 1 AND f.field_no_view = 0';
break;
case 'profile':
// Show hidden fields to moderators/admins
if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
{
- $sql_where .= ' AND f.field_hide = 0';
+ $sql_where .= ' AND f.field_show_profile = 1';
}
break;
@@ -106,7 +106,7 @@ class custom_profile
{
case FIELD_DATE:
$field_validate = explode('-', $field_value);
-
+
$day = (isset($field_validate[0])) ? (int) $field_validate[0] : 0;
$month = (isset($field_validate[1])) ? (int) $field_validate[1] : 0;
$year = (isset($field_validate[2])) ? (int) $field_validate[2] : 0;
@@ -154,14 +154,14 @@ class custom_profile
return 'FIELD_TOO_LARGE';
}
break;
-
+
case FIELD_DROPDOWN:
if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
{
return 'FIELD_REQUIRED';
}
break;
-
+
case FIELD_STRING:
case FIELD_TEXT:
if (empty($field_value) && !$field_data['field_required'])
@@ -205,7 +205,7 @@ class custom_profile
global $db, $user, $auth;
$this->profile_cache = array();
-
+
// Display hidden/no_view fields for admin/moderator
$sql = 'SELECT l.*, f.*
FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f
@@ -234,7 +234,7 @@ class custom_profile
if ($preview)
{
$lang_options = (!is_array($this->vars['lang_options'])) ? explode("\n", $this->vars['lang_options']) : $this->vars['lang_options'];
-
+
foreach ($lang_options as $num => $var)
{
$this->options_lang[$field_id][$lang_id][($num + 1)] = $var;
@@ -271,14 +271,14 @@ class custom_profile
{
case 'register':
// If the field is required we show it on the registration page and do not show hidden fields
- $sql_where .= ' AND (f.field_show_on_reg = 1 OR f.field_required = 1) AND f.field_hide = 0';
+ $sql_where .= ' AND f.field_show_on_reg = 1 AND f.field_no_view = 0';
break;
case 'profile':
// Show hidden fields to moderators/admins
if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
{
- $sql_where .= ' AND f.field_hide = 0';
+ $sql_where .= ' AND f.field_show_profile = 1';
}
break;
@@ -316,12 +316,12 @@ class custom_profile
case 'FIELD_TOO_SMALL':
$error = sprintf($user->lang[$cp_result], $row['lang_name'], $row['field_minlen']);
break;
-
+
case 'FIELD_TOO_LONG':
case 'FIELD_TOO_LARGE':
$error = sprintf($user->lang[$cp_result], $row['lang_name'], $row['field_maxlen']);
break;
-
+
case 'FIELD_INVALID_CHARS':
switch ($row['field_validation'])
{
@@ -339,7 +339,7 @@ class custom_profile
}
break;
}
-
+
if ($error != '')
{
$cp_error[] = $error;
@@ -434,7 +434,7 @@ class custom_profile
'S_PROFILE_' . strtoupper($ident) => true
);
}
-
+
return $tpl_fields;
}
else
@@ -589,7 +589,7 @@ class custom_profile
else
{
$value = (isset($_REQUEST[$profile_row['field_ident']])) ? request_var($profile_row['field_ident'], $default_value, true) : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
-
+
if (gettype($value) == 'string')
{
$value = utf8_normalize_nfc($value);
@@ -672,7 +672,7 @@ class custom_profile
$profile_row['s_year_options'] .= '<option value="' . $i . '"' . (($i == $year) ? ' selected="selected"' : '') . ">$i</option>";
}
unset($now);
-
+
$profile_row['field_value'] = 0;
$template->assign_block_vars($this->profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
}
@@ -826,7 +826,7 @@ class custom_profile
$cp_data['pf_' . $row['field_ident']] = (in_array($row['field_type'], array(FIELD_TEXT, FIELD_STRING))) ? $row['lang_default_value'] : $row['field_default_value'];
}
$db->sql_freeresult($result);
-
+
return $cp_data;
}
@@ -838,9 +838,9 @@ class custom_profile
{
global $phpbb_root_path, $phpEx;
global $config;
-
+
$var_name = 'pf_' . $profile_row['field_ident'];
-
+
switch ($profile_row['field_type'])
{
case FIELD_DATE:
@@ -860,7 +860,7 @@ class custom_profile
$month = request_var($var_name . '_month', 0);
$year = request_var($var_name . '_year', 0);
}
-
+
$var = sprintf('%2d-%2d-%4d', $day, $month, $year);
break;
@@ -931,7 +931,7 @@ class custom_profile_admin extends custom_profile
return $validate_options;
}
-
+
/**
* Get string options for second step in ACP
*/
@@ -1086,4 +1086,4 @@ class custom_profile_admin extends custom_profile
}
}
-?> \ No newline at end of file
+?>
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 48fd4e3ad2..b5839f517a 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -548,6 +548,15 @@ $database_update_info = array(
// No changes from 3.0.3-RC1 to 3.0.3
'3.0.3-RC1' => array(),
+
+ // Changes from 3.0.3 to 3.0.4-RC1
+ '3.0.3' => array(
+ 'add_columns' => array(
+ PROFILE_FIELDS_TABLE => array(
+ 'field_show_profile' => array('BOOL', 0),
+ ),
+ ),
+ ),
);
// Determine mapping database type
@@ -1948,6 +1957,47 @@ function change_database_data(&$no_updates, $version)
$no_updates = false;
break;
+
+ // Changes from 3.0.3 to 3.0.4-RC1
+ case '3.0.3':
+ // Update the Custom Profile Fields based on previous settings to the new format
+ $sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide
+ FROM ' . PROFILE_FIELDS_TABLE;
+ $result = _sql($sql, $errored, $error_ary);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql_ary = array(
+ 'field_required' => 0,
+ 'field_show_on_reg' => 0,
+ 'field_hide' => 0,
+ 'field_show_profile'=> 0,
+ );
+
+ if ($row['field_required'])
+ {
+ $sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
+ }
+ else if ($row['field_show_on_reg'])
+ {
+ $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
+ }
+ else if ($row['field_hide'])
+ {
+ // Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module
+ $sql_ary['field_hide'] = 1;
+ }
+ else
+ {
+ // equivelant to "none", which is the "Display in user control panel" option
+ $sql_ary['field_show_profile'] = 1;
+ }
+
+ _sql('UPDATE ' . PROFILE_FIELDS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary);
+ }
+
+ $no_updates = false;
+ break;
}
}
@@ -3082,4 +3132,4 @@ function utf8_new_clean_string($text)
return trim($text);
}
-?> \ No newline at end of file
+?>
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index e3e2e43723..8ac371b9ed 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -786,6 +786,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
field_required INTEGER DEFAULT 0 NOT NULL,
field_show_on_reg INTEGER DEFAULT 0 NOT NULL,
+ field_show_profile INTEGER DEFAULT 0 NOT NULL,
field_hide INTEGER DEFAULT 0 NOT NULL,
field_no_view INTEGER DEFAULT 0 NOT NULL,
field_active INTEGER DEFAULT 0 NOT NULL,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 3a3d3fcbd4..445a0eda08 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -942,6 +942,7 @@ CREATE TABLE [phpbb_profile_fields] (
[field_validation] [varchar] (20) DEFAULT ('') NOT NULL ,
[field_required] [int] DEFAULT (0) NOT NULL ,
[field_show_on_reg] [int] DEFAULT (0) NOT NULL ,
+ [field_show_profile] [int] DEFAULT (0) NOT NULL ,
[field_hide] [int] DEFAULT (0) NOT NULL ,
[field_no_view] [int] DEFAULT (0) NOT NULL ,
[field_active] [int] DEFAULT (0) NOT NULL ,
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 01d8efa921..b4830a977c 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -550,6 +550,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varbinary(60) DEFAULT '' NOT NULL,
field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
+ field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index 0119e4ce9d..e546c66f0a 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -550,6 +550,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar(20) DEFAULT '' NOT NULL,
field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
+ field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index c9b138b8d8..85a0526071 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1056,6 +1056,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar2(60) DEFAULT '' ,
field_required number(1) DEFAULT '0' NOT NULL,
field_show_on_reg number(1) DEFAULT '0' NOT NULL,
+ field_show_profile number(1) DEFAULT '0' NOT NULL,
field_hide number(1) DEFAULT '0' NOT NULL,
field_no_view number(1) DEFAULT '0' NOT NULL,
field_active number(1) DEFAULT '0' NOT NULL,
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 32f3f0cd4a..cb9a30b423 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -737,6 +737,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar(20) DEFAULT '' NOT NULL,
field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0),
field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0),
+ field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0),
field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0),
field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0),
field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0),
@@ -1274,4 +1275,4 @@ CREATE TABLE phpbb_zebra (
-COMMIT; \ No newline at end of file
+COMMIT;
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index 8033b2d583..725c09169e 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -533,6 +533,7 @@ CREATE TABLE phpbb_profile_fields (
field_validation varchar(20) NOT NULL DEFAULT '',
field_required INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0',
field_active INTEGER UNSIGNED NOT NULL DEFAULT '0',
@@ -968,4 +969,4 @@ CREATE TABLE phpbb_zebra (
-COMMIT; \ No newline at end of file
+COMMIT;
diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php
index ca63c9c639..96d9fec0f8 100644
--- a/phpBB/language/en/acp/profile.php
+++ b/phpBB/language/en/acp/profile.php
@@ -64,10 +64,10 @@ $lang = array_merge($lang, array(
'DELETE_PROFILE_FIELD_CONFIRM' => 'Are you sure you want to delete this profile field?',
'DISPLAY_AT_PROFILE' => 'Display in user control panel',
'DISPLAY_AT_PROFILE_EXPLAIN' => 'The user is able to change this profile field within the user control panel.',
- 'DISPLAY_AT_REGISTER' => 'Display at registration screen',
- 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration and able to be changed within the user control panel.',
+ 'DISPLAY_AT_REGISTER' => 'Display on registration screen',
+ 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.',
'DISPLAY_PROFILE_FIELD' => 'Display profile field',
- 'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all places allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.',
+ 'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.',
'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line.',
'EDIT_DROPDOWN_LANG_EXPLAIN' => 'Please note that you are able to change your options text and also able to add new options to the end. It is not advised to add new options between existing options - this could result in wrong options assigned to your users. This can also happen if you remove options in-between. Removing options from the end result in users having assigned this item now reverting back to the default one.',
@@ -95,7 +95,7 @@ $lang = array_merge($lang, array(
'FIRST_OPTION' => 'First option',
'HIDE_PROFILE_FIELD' => 'Hide profile field',
- 'HIDE_PROFILE_FIELD_EXPLAIN' => 'Only administrators and moderators are able to see/fill out this profile field. If this option is enabled, the profile field will be only displayed in users’ profiles.',
+ 'HIDE_PROFILE_FIELD_EXPLAIN' => 'Hide the profile field from all other users except the user, administrators and moderators who are still able to see this field. If the Display in user control panel option is disabled, the user will not be able to see or change this field and the field can only be changed by administrators.',
'INVALID_CHARS_FIELD_IDENT' => 'Field identification can only contain lowercase a-z and _',
'INVALID_FIELD_IDENT_LEN' => 'Field identification can only be 17 characters long',
@@ -124,7 +124,7 @@ $lang = array_merge($lang, array(
'RADIO_BUTTONS' => 'Radio buttons',
'REMOVED_PROFILE_FIELD' => 'Successfully removed profile field.',
'REQUIRED_FIELD' => 'Required field',
- 'REQUIRED_FIELD_EXPLAIN' => 'Force profile field to be filled out or specified by user. This will display the profile field at registration and within the user control panel.',
+ 'REQUIRED_FIELD_EXPLAIN' => 'Force profile field to be filled out or specified by user or administrator. If display at registration screen option is disabled, the field will only be required when the user edits their profile.',
'ROWS' => 'Rows',
'SAVE' => 'Save',
@@ -148,7 +148,7 @@ $lang = array_merge($lang, array(
'USER_FIELD_NAME' => 'Field name/title presented to the user',
- 'VISIBILITY_OPTION' => 'Visibility option',
+ 'VISIBILITY_OPTION' => 'Visibility options',
));
-?> \ No newline at end of file
+?>