Problem/Motivation

When users cancel their own account, they're displayed with the message "A confirmation request to cancel your account has been sent to your e-mail address" - which is absolutely correct for this case.

However, when an admin cancels a user account and chooses to e-mail a confirmation request to such user, the same message is displayed - which is not correct. It should be something along the line of "A confirmation request to cancel this user account has been sent to the user’s e-mail address"

When an admin cancels a user account without choosing to e-mail a confirmation request to the user, all is well and a correct message is displayed (user@email.com was deleted).

Steps required to reproduce

  1. As an admin, click the 'cancel account' link for any user (other than yourself)
  2. Tick the 'Require e-mail confirmation to cancel account' option
  3. Click the 'cancel account' button

Expected behavior

The admin should see a message similar to "A confirmation request to cancel this user account has been sent to the user’s e-mail address".

What happened instead?

The admin sees the message "A confirmation request to cancel your account has been sent to your e-mail address" - which would be the expected behaviors if a user was cancelling his/her own account.
This message leads to confusion for admins (who actually reported this bug).

Proposed resolution

In the case where a user is cancelling their own account display the original message. In the case where anyone else is cancelling a user account display the message:

A confirmation request to cancel the account %name has been sent to the user's email address.

Remaining tasks

Review

User interface changes

A new message in the case that one user is cancelling another user's account.

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

Issue fork drupal-2980952

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jaxtheking created an issue. See original summary.

jaxtheking’s picture

Title: Wrong message on cancelling account with e-mail confirmation » Wrong message on cancelling account with e-mail confirmation request
Issue summary: View changes

Version: 7.59 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

guypaddock’s picture

Version: 7.x-dev » 8.9.x-dev
Issue tags: +Needs backport to D7

This still applies to Drupal 8.

guypaddock’s picture

Status: Active » Needs review
StatusFileSize
new2.26 KB

Attached is an attempt at the start of a patch. This still needs tests.

avpaderno’s picture

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8.9.x is in security support only.

aaronmchale’s picture

Version: 9.2.x-dev » 9.3.x-dev
vikashsoni’s picture

StatusFileSize
new14.46 KB
new9.53 KB

Applied patch
after patch user is able to cancel account with-out any email verification message for ref sharing screenshot

vikashsoni’s picture

aaronmchale’s picture

chetanbharambe’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new322.86 KB
new329.49 KB

Verified and tested patch #5.
Patch applied successfully and there is no difference.

Testing Steps:
# Goto: Appearance -> Apply Seven theme
# Goto: /admin/people
# Edit any user
# Click the 'cancel account' link for any user (other than yourself)
# Check the 'Require e-mail confirmation to cancel account' option
# Click the 'cancel account' button

Expected Results:
# User should see messages like "A confirmation request to cancel this user account has been sent to the user’s e-mail address"

Note: I don't see any difference before and after applying the patch. The same message is appearing.

Please refer attached screenshots for the same.
Looks good to me.
Can be a move to RTBC.

aaronmchale’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs usability review

We will be discussing this issue at #3244123: Drupal Usability Meeting 2021-10-22 so moving back to NR for now.

aaronmchale’s picture

Status: Needs review » Needs work
Issue tags: -Needs usability review +Needs issue summary update

We reviewed this issue today at #3244123: Drupal Usability Meeting 2021-10-22.

The recommendation was to change the message slightly for canceling the account of another user to add the name of the user instead of the text "the account".

So instead of:

A confirmation request to cancel the account has been sent to the user's email address.

It would be:

A confirmation request to cancel %name% has been sent to the user's email address.

This issue summary also needs an update as it looks like it comes from Drupal 7.

As a side note I think some of the other changes in the patch are out of scope, mainly:

+    $current_user = $this->currentUser();
+    $is_canceling_own_account = ($this->entity->id() == $current_user->id());
+
     // Cancel account immediately, if the current user has administrative
     // privileges, no confirmation mail shall be sent, and the user does not
     // attempt to cancel the own account.
-    if (!$form_state->isValueEmpty('access') && $form_state->isValueEmpty('user_cancel_confirm') && $this->entity->id() != $this->currentUser()->id()) {
+    if (!$form_state->isValueEmpty('access') && $form_state->isValueEmpty('user_cancel_confirm') && !$is_canceling_own_account) {
       user_cancel($form_state->getValues(), $this->entity->id(), $form_state->getValue('user_cancel_method'));

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mstrelan’s picture

Issue tags: +Bug Smash Initiative

This is still NW as per #13. I'm not sure about the suggested wording though. For example:

A confirmation request to cancel mstrelan has been sent to the user's email address.

I don't want to be cancelled!

aaronmchale’s picture

Issue tags: +Needs usability review
A confirmation request to cancel mstrelan has been sent to the user's email address.

I don't want to be cancelled!

Yeah I wouldn't want to be cancelled either so maybe we need to revisit this 😀

Yogesh Sahu’s picture

Status: Needs work » Needs review
StatusFileSize
new2.27 KB

re-rolling patch for 10.1.x

ranjit1032002’s picture

Status: Needs review » Reviewed & tested by the community

I had Reviewed the patch and it looks good and working as expected mentioned in comment #19

aaronmchale’s picture

Status: Reviewed & tested by the community » Needs review

Issue needs to go back to usability group for another review, setting back to NR.

rinku jacob 13’s picture

StatusFileSize
new114.57 KB
new120.8 KB

I have applied the patch #19. I think it's just a re-roll. It doesn't make any changes on message as per comment #13.

tanuj.’s picture

StatusFileSize
new1.8 KB
new1.6 KB

Adding a patch addressing the points mentioned in #13, removing out of scope code and updated message wording as per #17 so it doesn't sound weird. Please review.

tanuj.’s picture

StatusFileSize
new1.83 KB
new1.05 KB

Fixed CCF on #23

Status: Needs review » Needs work

The last submitted patch, 24: 2980952-24.patch, failed testing. View results

arunkumark’s picture

Assigned: Unassigned » arunkumark
arunkumark’s picture

Assigned: arunkumark » Unassigned
Status: Needs work » Needs review
StatusFileSize
new6.99 KB
new6.99 KB
new5.04 KB

Updated the patch with test case changes.

arunkumark’s picture

The last submitted patch, 27: 2980952-27.patch, failed testing. View results

The last submitted patch, 27: 2980952-27.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 27: interdiff-2980952-24-27.patch, failed testing. View results

arunkumark’s picture

Status: Needs work » Needs review
StatusFileSize
new6.83 KB
new746 bytes

Updated the testing scenario fixes.

Status: Needs review » Needs work

The last submitted patch, 32: 2980952-32.patch, failed testing. View results

arunkumark’s picture

Status: Needs work » Needs review

Seems the fail is random. Keeping to Review.

avpaderno’s picture

Status: Needs review » Needs work
+      else {
+        $messenger->addStatus($this->t("A confirmation request to cancel %name account has been sent to the user's email address.", ['%name' => $this->entity->label()]));
+      }

It should be to cancel the %name account, in the same way it is to the user's email address.

arunkumark’s picture

Assigned: Unassigned » arunkumark
arunkumark’s picture

Assigned: arunkumark » Unassigned
Status: Needs work » Needs review
StatusFileSize
new6.86 KB
new5.19 KB

#35 comment has been addressed with the latest Patch.

smustgrave’s picture

Status: Needs review » Needs work

#13 tagged this for issue summary update from the usability meeting at that time. Still needs to happen it seems.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

aaronmchale’s picture

Issue summary: View changes
Issue tags: -Needs usability review

Usability review

We discussed this issue at #3377568: Drupal Usability Meeting 2023-08-04. That issue will have a link to a recording of the meeting.

For the record, the attendees at today's usability meeting were @AaronMcHale, @Emma Horrell, @benjifisher, @rkoller, @simohell, and @worldlinemine.

We reviewed this in the context of the recent discussion. In comment #13 we recommended the following:

A confirmation request to cancel %name% has been sent to the user's email address.

However, it was pointed out that this wording could imply that the person themselves is being cancelled, and to quote @mstrelan in comment #17:

A confirmation request to cancel mstrelan has been sent to the user's email address.

I don't want to be cancelled!

With that in mind, we are now recommending the following wording, which should address the concern and is a slightly variation on the previous recommendation, adding the text "the account":

A confirmation request to cancel the account %name has been sent to the user's email address.

We considered a slightly shorter version, without the text "to the user's email address", however while we normally follow the less-is-more principle, we felt it was better to be explicit that the request is indeed being sent to the user's email address.

We also considered a couple of other variations on account %name, including: account (%name) and %name account, but we felt these were a bit awkward when reading the complete sentence.

I should also note that if #3229146: Rename "Account cancellation" to "Account closure" in UI is done, then this wording will change again slightly, replacing the word "cancel" with the word "close".

Also cleaning up the issue summary as it's a bit out of date now.

aaronmchale’s picture

Updated previous comment to note other variations on account %name that were considered. I think this still needs an IS update, so leaving that tag.

Akhil Babu made their first commit to this issue’s fork.

akhil babu’s picture

Issue tags: -Needs issue summary update
StatusFileSize
new59.23 KB

The issue summary is clear and up to date. So removing the tag
I have changed the message to A confirmation request to cancel the account %name has been sent to the user's email address as suggested in #40.
https://www.drupal.org/files/issues/2024-01-24/2980952-new-message.png. Raising it as a merge request.

akhil babu’s picture

Status: Needs work » Needs review
sandeep_k’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new68.39 KB
new72.36 KB

Hi @Akhil Babu, I've Tested the shared MR-MR !6303 mergeable on Drupal Version- 11.0-dev, The Patch was applied successfully and looks good to me.

Testing Steps:

  1. Install Drupal-11.
  2. Go to> admin/people- Create a new user.
  3. Edit the user & Click on the Cancel Account and Check the 'Require email confirmation' check box. Attached before results.
  4. Download the shared patch & apply.
  5. Go to> admin/people- Edit the user & follow the above steps to re-verify this.

Testing Results:
After applying the patch, the confirmation message has been changed. RTBC++

larowlan’s picture

Status: Reviewed & tested by the community » Needs work

I think the code here is currently not working the way we expect it to, i.e. the condition is always false and therefore the case where the user is cancelling their account is showing the wrong message.

This likely means some of the test changes were not correct

dcam made their first commit to this issue’s fork.

dcam’s picture

I can confirm that this does need work. The confirmation message is now incorrect when a user cancels their own email address:

A confirmation request to cancel the account example_user has been sent to the user's email address.

dcam changed the visibility of the branch 11.x to hidden.

dcam’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Can the issue summary be flushed out some please

Always recommend to never remove summary heading, even if they don't apply just leave blank or put NA.

Put proposed solution can it be more specific, don't need code but looking at the changes seems to be doing more then just altering the message.

If you are another contributor eager to jump in, please allow the previous poster at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

dcam’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update

Updated the issue summary.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs backport to D7 +Needs Review Queue Initiative

Believe feedback on this one has been addressed
Hiding patches since the fix is in the MR

nod_’s picture

Status: Reviewed & tested by the community » Needs work

small code improvement needed

smustgrave’s picture

Issue tags: +Atlanta2025
dcam’s picture

Status: Needs work » Needs review

I applied the suggestion and rebased the MR too.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Feedback appears to be addressed.

  • nod_ committed dee0d98a on 11.x
    Issue #2980952 by dcam, arunkumark, tanuj., guypaddock, Yogesh Sahu,...
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4760161 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.