I've been working on creating a feature which allows certain non-admin but higher-than-user roles within a Drupal 8.8 system to delete users from the system. In essence, only admin and 'moderator' accounts have access to the Drupal, and they need to all be able to 'cancel' a user account from a bulk action.
My problem is that despite setting all permissions correctly and according to the guides, the moderators are always given a choice to choose which cancellation method they wish to use on the account, and then need to confirm the deletion. This happens despite these accounts not having the permission to do so.
I simply want the system to, upon clicking on the action 'cancel this account,' to cancel and delete all the accounts without confirmation or anything else. Just click and go. I've tried implementing this using hooks, including hook_user_cancel_methods_alter as shown below by not giving administer rights and dropping that requirement, but nothing seems to work.
function clientname_user_cancel_methods_alter(&$methods) {
unset($methods['user_cancel_delete']['access']);
}
Simply put: how can I skip the confirmation screen for a user cancellation/deletion in Drupal 8.8?