Skip to content
Snippets Groups Projects
Commit bf518433 authored by git's avatar git Committed by Azz-eddine BERRAMOU
Browse files

Issue #3301090 by Tim Lammar: User is blocked instead of deleted if the user...

Issue #3301090 by Tim Lammar: User is blocked instead of deleted if the user has more than 10 nodes (author)
parent f0e4182c
Branches
Tags
No related merge requests found
......@@ -113,13 +113,25 @@ function reassign_user_content_user_cancel($edit, UserInterface $account, $metho
* @see _user_cancel()
*/
function reassign_user_content_batch_alter(&$batch) {
if (isset($batch['sets'][1]['operations'][0][0]) &&
$batch['sets'][1]['operations'][0][0] == '_user_cancel' &&
isset($batch['sets'][1]['operations'][0][1][2]) &&
$batch['sets'][1]['operations'][0][1][2] == 'user_cancel_reassign_content'
$values = isset($batch['form_state']) ? $batch['form_state']->getValues() : [];
// Only go over the bath sets if we come from the form-submit
// of the user cancel form and our method was selected.
if (
isset($values['user_cancel_method']) &&
$values['user_cancel_method'] === 'user_cancel_reassign_content'
) {
// Change the batch operation callback.
$batch['sets'][1]['operations'][0][0] = '_reassign_user_content';
// For every account that gets deleted, the batch was created.
// Change all of them.
foreach ($batch['sets'] as &$set) {
if (isset($set['operations'][0][0]) &&
$set['operations'][0][0] == '_user_cancel' &&
isset($set['operations'][0][1][2]) &&
$set['operations'][0][1][2] == 'user_cancel_reassign_content'
) {
// Change the batch operation callback.
$set['operations'][0][0] = '_reassign_user_content';
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment