diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 45c272db54..77b88b5715 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -256,7 +256,7 @@ p a {
[Fix] Remember selected language while registering after submit (Bug #11435)
[Fix] UTF-8 support in theme and template editors (Bug #12251)
[Fix] Allow for posts per page in the MCP to change during topic selection (Bug #12067)
-
+ [Fix] Remove group avatars upon deletion from all profiles, not just the people having the group as default (Bug #12275, #12267)
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index d40a8ae47b..07088de75d 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -359,7 +359,7 @@ class acp_groups
{
if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
{
- avatar_delete('group', $group_row);
+ avatar_delete('group', $group_row, true);
}
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 9e83281f92..53fb65d0f0 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1761,7 +1761,7 @@ function validate_jabber($jid)
/**
* Remove avatar
*/
-function avatar_delete($mode, $row)
+function avatar_delete($mode, $row, $clean_db = false)
{
global $phpbb_root_path, $config, $db, $user;
@@ -1774,6 +1774,10 @@ function avatar_delete($mode, $row)
}
}
+ if ($clean_db)
+ {
+ avatar_remove_db($row[$mode . '_avatar']);
+ }
$filename = get_avatar_filename($row[$mode . '_avatar']);
if (file_exists($phpbb_root_path . $config['avatar_path'] . '/' . $filename))
{
@@ -2415,6 +2419,22 @@ function group_correct_avatar($group_id, $old_entry)
}
}
+
+/**
+* Remove avatar also for users not having the group as default
+*/
+function avatar_remove_db($avatar_name)
+{
+ global $config, $db;
+
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_avatar = '',
+ user_avatar_type = 0
+ WHERE user_avatar = '" . $db->sql_escape($avatar_name) . '\'';
+ $db->sql_query($sql);
+}
+
+
/**
* Group Delete
*/
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index c964bffec5..d926801b2f 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -548,7 +548,7 @@ class ucp_groups
{
if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
{
- avatar_delete('group', $group_row);
+ avatar_delete('group', $group_row, true);
}
}