1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 19:24:01 +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);
}
?>
?>

View File

@@ -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,

View File

@@ -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 ,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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;
COMMIT;

View File

@@ -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;
COMMIT;