diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-06-04 17:30:16 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-06-04 17:30:16 +0200 |
commit | f3f82bd3776047ba99d0ba828ce43ff743e65b02 (patch) | |
tree | ab1b5270390abaf6b539535871c8f23aacb6c8d0 /phpBB/includes/functions_user.php | |
parent | 6813735d82d5309327e63d8308988f81554d2299 (diff) | |
parent | 9005711ad70148c0ee73f648a96dcc720644e9f9 (diff) | |
download | forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar.gz forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar.bz2 forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar.xz forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.zip |
Merge branch '3.1.x'
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r-- | phpBB/includes/functions_user.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 85b6f2be62..b0f58ba680 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -502,6 +502,9 @@ function user_delete($mode, $user_ids, $retain_username = true) $num_users_delta = 0; + // Get auth provider collection in case accounts might need to be unlinked + $provider_collection = $phpbb_container->get('auth.provider_collection'); + // Some things need to be done in the loop (if the query changes based // on which user is currently being deleted) $added_guest_posts = 0; @@ -512,6 +515,38 @@ function user_delete($mode, $user_ids, $retain_username = true) avatar_delete('user', $user_row); } + // Unlink accounts + foreach ($provider_collection as $provider_name => $auth_provider) + { + $provider_data = $auth_provider->get_auth_link_data($user_id); + + if ($provider_data !== null) + { + $link_data = array( + 'user_id' => $user_id, + 'link_method' => 'user_delete', + ); + + // BLOCK_VARS might contain hidden fields necessary for unlinking accounts + if (isset($provider_data['BLOCK_VARS']) && is_array($provider_data['BLOCK_VARS'])) + { + foreach ($provider_data['BLOCK_VARS'] as $provider_service) + { + if (!array_key_exists('HIDDEN_FIELDS', $provider_service)) + { + $provider_service['HIDDEN_FIELDS'] = array(); + } + + $auth_provider->unlink_account(array_merge($link_data, $provider_service['HIDDEN_FIELDS'])); + } + } + else + { + $auth_provider->unlink_account($link_data); + } + } + } + // Decrement number of users if this user is active if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE) { |