mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 05:20:56 +02:00
Merge branch 'ticket/9549' into develop
* ticket/9549: [ticket/9549] Display users in their primary group instead of their first group [ticket/9549] Change default value of "sort legend by group name" to false. [ticket/9549] Fix displaying empty groups [ticket/9549] Fix language strings. [ticket/9549] Only add group to legend/teampage when the checkbox is checked. [ticket/9549] New method move() to move a group more than 1 up/down. [ticket/9549] Fix some minor issues with descriptions and coding-guidelines. [ticket/9549] Throw an error when the given field-name is invalid. [ticket/9549] Make the class non static and extend delete_group function. [ticket/9549] Add template changes for subsilver2. [ticket/9549] Enhance teampage and legend functionality [ticket/9549] Add the module and files for the ACP. [ticket/9549] Update database with the new config values and columns [ticket/9549] Enhance teampage functionality with a new class, group_positions. Conflicts: phpBB/install/database_update.php
This commit is contained in:
@@ -2457,6 +2457,69 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$current_legend = phpbb_group_positions::GROUP_DISABLED;
|
||||
$current_teampage = phpbb_group_positions::GROUP_DISABLED;
|
||||
|
||||
$legend = new phpbb_group_positions($db, 'legend');
|
||||
$teampage = new phpbb_group_positions($db, 'teampage');
|
||||
if ($group_id)
|
||||
{
|
||||
$current_legend = $legend->get_group_value($group_id);
|
||||
$current_teampage = $teampage->get_group_value($group_id);
|
||||
}
|
||||
|
||||
if (!empty($group_attributes['group_legend']))
|
||||
{
|
||||
if (($group_id && ($current_legend == phpbb_group_positions::GROUP_DISABLED)) || !$group_id)
|
||||
{
|
||||
// Old group currently not in the legend or new group, add at the end.
|
||||
$group_attributes['group_legend'] = 1 + $legend->get_group_count();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Group stayes in the legend
|
||||
$group_attributes['group_legend'] = $current_legend;
|
||||
}
|
||||
}
|
||||
else if ($group_id && ($current_legend > phpbb_group_positions::GROUP_DISABLED))
|
||||
{
|
||||
// Group is removed from the legend
|
||||
$legend->delete_group($group_id, true);
|
||||
$group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED;
|
||||
}
|
||||
|
||||
if (!empty($group_attributes['group_teampage']))
|
||||
{
|
||||
if (($group_id && ($current_teampage == phpbb_group_positions::GROUP_DISABLED)) || !$group_id)
|
||||
{
|
||||
// Old group currently not on the teampage or new group, add at the end.
|
||||
$group_attributes['group_teampage'] = 1 + $teampage->get_group_count();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Group stayes on the teampage
|
||||
$group_attributes['group_teampage'] = $current_teampage;
|
||||
}
|
||||
}
|
||||
else if ($group_id && ($current_teampage > phpbb_group_positions::GROUP_DISABLED))
|
||||
{
|
||||
// Group is removed from the teampage
|
||||
$teampage->delete_group($group_id, true);
|
||||
$group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED;
|
||||
}
|
||||
|
||||
// Unset the objects, we don't need them anymore.
|
||||
unset($legend);
|
||||
unset($teampage);
|
||||
|
||||
$user_ary = array();
|
||||
$sql_ary = array(
|
||||
'group_name' => (string) $name,
|
||||
@@ -2681,6 +2744,14 @@ function group_delete($group_id, $group_name = false)
|
||||
}
|
||||
while ($start);
|
||||
|
||||
// Delete group from legend and teampage
|
||||
$legend = new phpbb_group_positions($db, 'legend');
|
||||
$legend->delete_group($group_id);
|
||||
unset($legend);
|
||||
$teampage = new phpbb_group_positions($db, 'teampage');
|
||||
$teampage->delete_group($group_id);
|
||||
unset($teampage);
|
||||
|
||||
// Delete group
|
||||
$sql = 'DELETE FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_id = $group_id";
|
||||
|
Reference in New Issue
Block a user