1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 10:16:36 +02:00

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
This commit is contained in:
Meik Sievertsen
2008-11-26 19:58:35 +00:00
parent 63b089f653
commit fb77cdd051
15 changed files with 150 additions and 92 deletions

View File

@@ -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);
}
?>
?>