aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/database_update.php
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/install/database_update.php
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/install/database_update.php')
-rw-r--r--phpBB/install/database_update.php52
1 files changed, 51 insertions, 1 deletions
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
+?>