From fb8dc345ddfcbcd6e6192c7361cb8f75a08940e6 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 3 Feb 2007 12:30:59 +0000 Subject: [PATCH] because so many 2.0.x users expect this we set every 2.0.x admin as a founder and full admin rights in 3.0.x. After conversion the main admin may want to remove the founder status from the other admins. Before, this only was able to be done by the first admin who was not always the one converting the board. git-svn-id: file:///svn/phpbb/trunk@6963 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../install/convertors/functions_phpbb20.php | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 271c1cf1e3..14d98deed2 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -475,22 +475,27 @@ function phpbb_convert_authentication($mode) $db->sql_query($convert->truncate_statement . ACL_USERS_TABLE); $db->sql_query($convert->truncate_statement . ACL_GROUPS_TABLE); - // Grab user id of first user with user_level of ADMIN + // What we will do is handling all 2.0.x admins as founder to replicate what is common in 2.0.x. + // After conversion the main admin need to make sure he is removing permissions and the founder status if wanted. + + // Grab user ids of users with user_level of ADMIN $sql = "SELECT user_id FROM {$convert->src_table_prefix}users WHERE user_level = 1 ORDER BY user_regdate ASC"; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $user_id = (int) phpbb_user_id($row['user_id']); + + // Set founder admin... + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_type = ' . USER_FOUNDER . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + } $db->sql_freeresult($result); - - $founder_id = phpbb_user_id($row['user_id']); - - // Set a founder admin ... we'll assume it's the first user with admin level access - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_type = ' . USER_FOUNDER . " - WHERE user_id = $founder_id"; - $db->sql_query($sql); } // Grab forum auth information @@ -666,7 +671,7 @@ function phpbb_convert_authentication($mode) } else if ($mode == 'first') { - // Go through all 2.0.x forums (we saved those ids for reference) + // Go through all 2.0.x forums foreach ($forum_access as $forum) { $new_forum_id = (int) $forum['forum_id']; @@ -817,8 +822,8 @@ function phpbb_convert_authentication($mode) mass_auth('group_role', 0, 'administrators', 'USER_FULL'); mass_auth('group_role', 0, 'global_moderators', 'USER_FULL'); - // By default all converted administrators are given standard access (the founder still have full access) - mass_auth('group_role', 0, 'administrators', 'ADMIN_STANDARD'); + // By default all converted administrators are given full access + mass_auth('group_role', 0, 'administrators', 'ADMIN_FULL'); // All registered users are assigned the standard user role mass_auth('group_role', 0, 'registered', 'USER_STANDARD');