From cb8cd50495eb9d75cae8e7f1450033acfdb0b374 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 2 Nov 2013 12:49:28 +0100 Subject: [ticket/11031] Correctly add groups to teampage PHPBB3-11031 --- phpBB/includes/functions_convert.php | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_convert.php') diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 10d5abed76..cdab8f2491 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1748,7 +1748,7 @@ function add_default_groups() 'group_type' => GROUP_SPECIAL, 'group_colour' => (string) $data[0], 'group_legend' => (int) $data[1], - 'group_founder_manage' => (int) $data[2] + 'group_founder_manage' => (int) $data[2], ); } @@ -1758,6 +1758,38 @@ function add_default_groups() } } +function add_groups_to_teampage() +{ + global $db; + + $teampage_groups = array( + 'ADMINISTRATORS' => 1, + 'GLOBAL_MODERATORS' => 2, + ); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', array_keys($teampage_groups)); + $result = $db->sql_query($sql); + + $teampage_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $teampage_ary[] = array( + 'group_id' => (int) $row['group_id'], + 'teampage_name' => '', + 'teampage_position' => (int) $teampage_groups[$row['group_name']], + 'teampage_parent' => 0, + ); + } + $db->sql_freeresult($result); + + if (sizeof($teampage_ary)) + { + $db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_ary); + } +} + /** * Sync post count. We might need to do this in batches. -- cgit v1.2.1