Can we add rejected reason during the account cancellation of the user?

Not applicable

@Anil Sagar As off now i can see only below radio button option when i click on cancel account


Disable the account and keep its content:

Disable the account and unpublish its content:

Delete the account, but make its content belong to the Anonymous user

Delete the account and its content

Require e-mail confirmation to cancel account

Solved Solved
1 4 196
1 ACCEPTED SOLUTION

You're going to solve your problem in 2 steps:

  1. add a field to each user entity. This field will contain the "rejection reason". It will contain either the value "None", or one of a set of values that you specify, like "Violation", or "Not confirmed" or "Expired" or whatever reason you want to use, for manually rejecting a user.
  2. You will add a Rule, that fires when a user account gets updated. This rule will check the rejection reason and the user status, and if the user status is "blocked", then the rule will send an email to the user's email address.

In more detail:

  1. To add a field to a user entity, visit 'admin/config/people/accounts/fields'. "Add field". Use the field name "rejection" . Specify the type of the field to be "List (text)" and "select list". Save. Then in the following screen, specify the rejection reasons. Save.
  2. To create a Rule, first ensure you have enabled the Rules module in Drupal. Visit admin/modules . Search for "Rules". If the module is not enabled, enable it. Also enable "Rules_UI" . Save.
  3. Then, you will add a new rule. Visit admin/config/workflow/rules .
  4. Specify:
    1. Event: After updating an existing user account
    2. Condition: user is blocked
      AND
      Condition: Data comparison. "account-unchanged:status" value: "Active"
      AND
      Condition: Data value is empty. with data selector: "account-unchanged:field-rejection"
    3. Action: Send account mail, email type: Account blocked.
    4. Save

It should look like this:

5700-screenshot-20170925-095615.png

To modify the email template used for sending that mail, visit 'admin/config/people/accounts' , scroll down and find the "Emails" section, select the "Account blocked" template, and make your changes. You may want to include the reason for the account cancellation in the template.

View solution in original post

4 REPLIES 4

Can we add rejected reason during the account cancellation of the user?

when you say "add rejected reason"... what do you want to add the reason TO ? Elaborate on exactly what you are thinking? Do you want a record in the database attached to each user? Do you want to send an email to the user? to the administrators? Explain a little more.

Not applicable

@Dino Thanks for the reply, Here is the summary,When Admin will reject or cancel the registration, the user status will be ‘rejected’ with a given reason or admin can select a reason from the drop down. A mail with this status and reason send to the user. I want to create a View/Page where Admin will be able to see the status of the user, and other details. for example if the user is not active , then what is the status. with reason. ?

Yes, Mail need to be send to the Admin as well as to the User.

Yes want to add the record in the database, so that we can pull the details to the page.

You're going to solve your problem in 2 steps:

  1. add a field to each user entity. This field will contain the "rejection reason". It will contain either the value "None", or one of a set of values that you specify, like "Violation", or "Not confirmed" or "Expired" or whatever reason you want to use, for manually rejecting a user.
  2. You will add a Rule, that fires when a user account gets updated. This rule will check the rejection reason and the user status, and if the user status is "blocked", then the rule will send an email to the user's email address.

In more detail:

  1. To add a field to a user entity, visit 'admin/config/people/accounts/fields'. "Add field". Use the field name "rejection" . Specify the type of the field to be "List (text)" and "select list". Save. Then in the following screen, specify the rejection reasons. Save.
  2. To create a Rule, first ensure you have enabled the Rules module in Drupal. Visit admin/modules . Search for "Rules". If the module is not enabled, enable it. Also enable "Rules_UI" . Save.
  3. Then, you will add a new rule. Visit admin/config/workflow/rules .
  4. Specify:
    1. Event: After updating an existing user account
    2. Condition: user is blocked
      AND
      Condition: Data comparison. "account-unchanged:status" value: "Active"
      AND
      Condition: Data value is empty. with data selector: "account-unchanged:field-rejection"
    3. Action: Send account mail, email type: Account blocked.
    4. Save

It should look like this:

5700-screenshot-20170925-095615.png

To modify the email template used for sending that mail, visit 'admin/config/people/accounts' , scroll down and find the "Emails" section, select the "Account blocked" template, and make your changes. You may want to include the reason for the account cancellation in the template.

@DinoThanks for such a nice explanation.. Also i need to know if I have added a free text field, where admin can write the rejected reason. And I want that same reason need to be sent in the mail. Can we do this ?