Still not a perfect fix, but it should be better. To illustrate the problem:
Whenever the default group is changed, we have to apply group avatars and ranks. The group value is then copied to the user table, where it is not easily decideable whatever or not it is a group value or a special value.
If we change the default group of an user, we want that user to lose the group rank/avatar; however, we also have to dispose special ranks etc. in the process.
Bottom line: use groups to assign ranks :|


git-svn-id: file:///svn/phpbb/trunk@7927 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2007-07-23 11:03:20 +00:00
parent 2fdb32bc1d
commit 4299475256
2 changed files with 5 additions and 5 deletions

View file

@ -268,7 +268,7 @@ p a {
<li>[Fix] Allow for polls to work during preview (Bug #13657) - thanks to Thatbitextra</li> <li>[Fix] Allow for polls to work during preview (Bug #13657) - thanks to Thatbitextra</li>
<li>[Fix] Finer error conditions for sending IM messages (Bugs #13681, #13683)</li> <li>[Fix] Finer error conditions for sending IM messages (Bugs #13681, #13683)</li>
<li>[Fix] Add a confirmation for log deletion in the MCP (Bug #13693)</li> <li>[Fix] Add a confirmation for log deletion in the MCP (Bug #13693)</li>
<li>[Fix] Do not erase ranks and avatars when changing default groups (Bugs #13701, #13697)</li>
</ul> </ul>

View file

@ -2396,7 +2396,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
if (sizeof($user_ary)) if (sizeof($user_ary))
{ {
group_set_user_default($group_id, $user_ary, $sql_ary); group_set_user_default($group_id, $user_ary, $sql_ary, false, true);
} }
} }
@ -2893,7 +2893,7 @@ function group_validate_groupname($group_id, $group_name)
* *
* @private * @private
*/ */
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false) function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false, $same_group = false)
{ {
global $db; global $db;
@ -2930,8 +2930,8 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
{ {
if (isset($group_attributes[$attribute])) if (isset($group_attributes[$attribute]))
{ {
// If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set... // If we are about to set an avatar or rank, we will not overwrite with empty, unless we are not actually changing the default group
if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute]) if (!$same_group && (strpos($attribute, 'group_avatar') === 0 || strpos($attribute, 'group_rank') === 0) && !$group_attributes[$attribute])
{ {
continue; continue;
} }