Needs work
Project:
Drupal core
Version:
main
Component:
user.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 May 2012 at 20:09 UTC
Updated:
3 Feb 2026 at 15:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
donutdan4114 commentedI think I fixed the issue, submitting my first patch ever..
Comment #2
dandaman commentedIn my quick test of creating a couple accounts and trying to delete them it seems like it worked for me. Thanks!
Comment #3
donutdan4114 commentedComment #4
David_Rothstein commentedThanks for the patch! However, I assume this issue exists in Drupal 8 too, in which case it needs to be fixed there and backported.
Also looks like a possible duplicate of #935232: "Require e-mail confirmation to cancel account" when cancelling multiple accounts., although since this issue already has a patch I'll mark that one duplicate instead.
Comment #5
David_Rothstein commentedWhoa, I definitely added the wrong tag there :)
Comment #6
donutdan4114 commentedHere's Drupal 8 version of the patch.
Not sure how to backport... But now this thread has both patches in it :)
Comment #7
donutdan4114 commentedCan anyone review this properly for Drupal 8?
I don't have a mail server set up and I think this is a pretty important fix actually.
Comment #8
donutdan4114 commentedComment #9
David_Rothstein commented#6: drupal8-cancel_user_email_fix-1599286-6.patch queued for re-testing.
Comment #10
alexpottNice work @donutdan4114... generally we don't rtbc our own patches!
Also as this is a bug we need to write a test to make sure we don't break this in the future... You need to write a simpletest (https://drupal.org/simpletest) and this will help you test emails... http://api.drupal.org/api/drupal/modules%21simpletest%21drupal_web_test_...
Comment #11
donutdan4114 commentedThanks for the info @alexpott, not sure when I'll have enough time to do those tests. If someone else wants to write the tests, that'd be helpful...
Comment #12
alexpottRestoring tag
Comment #13
alexpottWow d.o it says I've added the tag but it didn't really add! lets try again...
Comment #14
donutdan4114 commentedDrupal7 patch is in comment #1.
Comment #15
donutdan4114 commentedDrupal 7 patch with tests (cannot currently get Drupal 8 setup on my local).
Comment #16
donutdan4114 commentedAttempting to roll D8 patch even though I can't install D8 on my local yet.
Comment #17
alexpott@donutdan4114 thanks for the work!
Should be less than 80 chars and start with Creates (see http://drupal.org/coding-standards)... but as this is a test it should be something like:
Tests e-mail notification during multiple user cancellation.This should be written like this:
It's not really necessary to test the text here - this patch has not changed the text.
With the changes suggested before we can remove this.
We should just assert that each message appears in the content here...
Rather than combining all the assertions in to one just
$this->assertTrue($user->status, "User still enabled after cancel confirmation sent");or something like that.Missing a spaces and I think the message can be improved (which means the test has to change).. something along the lines of
drupal_set_message(t('Cancellation request sent to %email.', array('%email' => $account->mail)));Comment #18
twistor commented*edit Alexpott got to it first.
Comment #19
donutdan4114 commentedUpdated patch based on @alexpott recommendations.
Comment #21
tim.plunkettJust a couple more tweaks:
Only need on blank line
public function testMassUserCancelByAdminConfirm() {
This needs to be
\Drupal::config('user.settings'), sorry about the confusionYou can combine this, no need for a variable.
$this->drupalLogin($this->drupalCreateUser(array('administer users')));You don't need the array(), that's the default value
e-emails
Use single quotes unless double quotes are needed.
Comment #22
donutdan4114 commentedThanks @tim.plunkett for more good feedback
Comment #24
donutdan4114 commentedbad patch..
Comment #25
donutdan4114 commentedUploading a non-empty patch this time.
Comment #27
donutdan4114 commentedTrying assertRaw().
Comment #28
donutdan4114 commentedTrying to apply D7 patch to D8, doesn't work...
Comment #30
donutdan4114 commentedTiny update to the D8 patch.
Comment #31
donutdan4114 commentedD7 patch update.
Comment #32
donutdan4114 commentedBumping this, as it's been fixed for awhile and should be fixed in both Drupal 7 and 8.
Comment #33
tim.plunkettNo one will review it if its marked for the wrong version.
Comment #34
tim.plunkett#30: drupal8-confirm_user_cancel_with_tests-1599286-29.patch queued for re-testing.
Comment #35
donutdan4114 commentedCreated new Drupal 8 patch, the whole user cancellation process changed since the previous patch.
Comment #37
donutdan4114 commentedTry #2
Comment #39
donutdan4114 commentedTry #3
Comment #41
donutdan4114 commentedChanged
$account->uidto$account->id()..Comment #43
donutdan4114 commentedI think I figured out all the new D8 changes...
Comment #44
donutdan4114 commented#43: drupal8-confirm_user_cancel_with_tests-1599286-43.patch queued for re-testing.
Comment #46
donutdan4114 commented#43: drupal8-confirm_user_cancel_with_tests-1599286-43.patch queued for re-testing.
Comment #48
donutdan4114 commented31: drupal7-confirm_user_cancel_with_tests-1599286-31.patch queued for re-testing.
Comment #50
donutdan4114 commentedComment #51
donutdan4114 commented31: drupal7-confirm_user_cancel_with_tests-1599286-31.patch queued for re-testing.
Comment #52
donutdan4114 commentedComment #53
fabianx commentedGenerally the patch for D7 looks good to me.
The code is just weird for the user_mail() call to stop the flow of the function ...
Can we return or use else {} instead?
Comment #54
donutdan4114 commentedFabianx, not sure what you're referring to.
Comment #59
donutdan4114 commentedPatch in #31 still good for Drupal 7.
Comment #60
David_Rothstein commentedThis still needs to be fixed in Drupal 8 first (https://www.drupal.org/core/backport-policy) - as far as I can see it wasn't fixed there yet.
Comment #61
donutdan4114 commentedAdded logic in D8 when deleting multiple user accounts to listen to the
user_cancel_confirmcheckbox.Comment #62
donutdan4114 commentedAdded test.
Comment #63
donutdan4114 commentedStill needs review/RTBC.... 3 years in the making.
Comment #70
dpiVerified as an ongoing concern.
It seems the only way you can get to this page with core is through the 'user_cancel_user_action' Action plugin (
\Drupal\user\Plugin\Action\CancelUser)Rewritten summary reflecting the current state of Drupal / appropriate references and terminology.
Comment #75
attila.fekete commentedSince #62 does not apply on >= 8.9, I tried to do a reroll. Also did a few minor changes.
Comment #76
kapilv commentedFix Custom Commands Failed.
Comment #77
kapilv commentedComment #78
attila.fekete commentedRetry.
Comment #79
attila.fekete commentedAnd again.
Comment #80
attila.fekete commentedComment #81
meenakshi_j commentedHi
Adding patch for 9.3.x for review.
Regarding #80: We ideally do the issue fixing in the latest fix version(9.3.x in this case) and generally do not back tag the core version unless we have a pressing reason to do so. The issue persists in the latest 9.3.x.
There were few deprecated functions used which I replaced respectively.
Comment #83
vikashsoni commentedApplied patch #81 in drupal -9.3.x-dev
Applied successfully and looks good for me
For ref sharing screenshots ....
Comment #85
casey commentedNote that without #2829964 this feature only works for users that already have an active session.
Comment #87
abelassComposer cannot apply this patch with drupal 9.4.8
Comment #90
mxr576Rerolled #81 patch for 10.1-dev and also improved how the issue is covered with tests. (For some reasons I could not generate a proper interdiff between #81 and my changes, sorry.)
#85 Thx for the heads up but if I am right that is not a blocker for solving this task.
Update: MR diff also applies on 9.4.8.
Comment #91
mxr576Comment #92
mxr576FTW, it passes on my local perfectly. Transient error? Let's retry...
Comment #93
christophweber commentedWe have had a previous patch in production for months without issues. This latest MR adds welcome test coverage.
Moving to RTBC.
Comment #94
quietone commentedI'm doing a light review of RTBC issues. It is really exciting to see an older issue get to RTBC. Thanks everyone!
This really needs an Issue Summary update. Explaining the resolution is valuable to reviewers and committers. Adding tag for an update. I tested the patch, not rigorously, and it does appear to work. I have yet to do a code review.
Comment #95
quietone commentedI reviewed, looking at the comments mostly. I can't comment on the quality of the fix itself.
I did not when testing the change that the admin does not get a status message when the cancel action is taken. The other actions I tried to show a message.
Comment #98
vensiresAttaching patch from current state of MR!2958.
Applies fine on latest Drupal 10.6.x.
The only drawback I have is that when the admin requires confirmation, the browser is redirected to the /admin/people page without any visible notification that the users were notified.