Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: https://api.drupal.org/api/drupal/modules%21user%21user.module/function/...
Now after deleting users we are going to the admin/people page.But I want to redirect to the front page after deleting users.
Since making changes in the drupal core module is a bad practice,I like to write a custom module for that.
Which function should I use for this.Can any one help
Comments
Comment #1
Jooblay.net CreditAttribution: Jooblay.net commentedDrupal will default to your system site set page. Go to example.com/admin/config/system/site-information and set your front page.
If your want custom pages to be set after a given action use a rule. Such "after content is updated" page redirect to node/123
Rules are really powerful....
Comment #2
ktrev CreditAttribution: ktrev commentedI have written a rule 'After deleting a user' redirect to front page.But this rule is not working.I have posted an issue regarding this in the 'Rules Module'.
Since the rule is not working I thought of writing a custom module for that.
in 'example.com/admin/config/system/site-information' my front page is set.
Comment #3
Jooblay.net CreditAttribution: Jooblay.net commentedHow are you deleting the user?
Rules have a learning curve take your time and check each step. If you want the rule to trigger the front page you will need to play with the permissions of the user "role" that is deleted. If your do not have the permission as the user to delete your own user account then the rule will not work. This also means you can not delete a user account via the user 1 admin and expect the rule to fire.
Comment #4
ktrev CreditAttribution: ktrev commentedI have created a new role 'Sitewise Admin' and gave "Administer user account" permission to that role.
So that a user with that role can delete other users if needed.But after deleting the users he should go to front page.
Comment #5
Jooblay.net CreditAttribution: Jooblay.net commentedYes then you will want to write a rule that set the condition "if user has role" then add an action to redirect to the front page:) that may help you out...
Comment #6
ktrev CreditAttribution: ktrev commentedOk, Thanks for your help. I will try this :)