diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2011-03-01 16:57:00 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2011-03-01 16:57:00 -0500 |
commit | 448df1cdf5d06e9457397ae439c04ad44084c2a9 (patch) | |
tree | e69a986e6910157ff8c1d1b51a267494e263c053 /phpBB/includes/functions_user.php | |
parent | 6c49f95b01c812144b16fdea74cc0841f354e810 (diff) | |
parent | 4ac8eaf9e3421f394136dc722542198b3048f4f8 (diff) | |
download | forums-448df1cdf5d06e9457397ae439c04ad44084c2a9.tar forums-448df1cdf5d06e9457397ae439c04ad44084c2a9.tar.gz forums-448df1cdf5d06e9457397ae439c04ad44084c2a9.tar.bz2 forums-448df1cdf5d06e9457397ae439c04ad44084c2a9.tar.xz forums-448df1cdf5d06e9457397ae439c04ad44084c2a9.zip |
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
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r-- | phpBB/includes/functions_user.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0a1260daed..dd96530265 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -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"; |