Thanks for the module Subuser!

How does one delete a subuser without any confirmation to the subuser and how to select the action details, like: delete or block user, delete contents or not?

Kind regards

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Snehal Brahmbhatt’s picture

1. How does one delete a subuser without any confirmation to the subuser.
>> You can disabled account disabled email from "Home » Administration » Configuration » People" (i.e. /user#overlay=admin/config/people/accounts) under "Email" section, click on "Account blocked" and untick checkbox "Notify user when account is blocked."

2. How to select the action details, like: delete or block user, delete contents or not?
>> Please find attached patch named "howto_delete_subuser-2502899-1.patch" for the same.

Let me know if any query/concern regarding this.

Thanks,
Snehal Brahmbhatt | AddWeb Solution
https://www.drupal.org/user/3147795/track

Snehal Brahmbhatt’s picture

Status: Active » Needs review
Snehal Brahmbhatt’s picture

FileSize
1.51 KB

Please find the patch howto_delete_subuser-2502899-3.patch for your purpose.

Hope this works for you flawlessly!

Thanks,
Snehal Brahmbhatt | AddWeb solution
https://www.drupal.org/user/3147795/track

saurabh.dhariwal’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for working on this issue! Here's some feedback:

  1. +++ b/subuser.module
    @@ -265,6 +265,12 @@ function subuser_form_alter(&$form, &$form_state, $form_id) {
    +      $form['user_cancel_method']['#access'] = true;
    +      $form['user_cancel_confirm']['#access'] = true;
    +      $form['user_cancel_confirm']['#default_value'] = false;
    +      $form['user_cancel_notify']['#access'] = true;
    

    This should probably be configurable. We can't assume everyone wants this.

  2. +++ b/subuser.module
    @@ -353,3 +359,25 @@ function subuser_ctools_plugin_api($module, $api) {
    +  if(in_array($acct_uid, $children)) {
    

    Missing space after if

  3. +++ b/subuser.module
    @@ -353,3 +359,25 @@ function subuser_ctools_plugin_api($module, $api) {
    +	user_cancel($form_state['values'], $account->uid, $form_state['values']['user_cancel_method']);
    

    Extra indentation

LeoVe’s picture

Snehal,
Thanks for your info.
The case is that we are using the subuser module to delegate user maintenance to people, without giving them full access to user maintenance (that is the tab "People"). But restricted to just to their "own" subusers with the module.

Snehal, Laurii,
Thanks for the patches, I will try to implement and test it in the coming week.

I'm a bit late with my comment because of a holiday, sorry for that.

Kind regards,

Leo

Snehal Brahmbhatt’s picture

FileSize
3.67 KB

Lauri,

Please find the attached updated patch "howto_delete_subuser-2502899-7.patch" as per your given feedback.

Hope this work flawlessly for you!

Thanks,
Snehal Brahmbhatt | AddWeb Solution
https://www.drupal.org/user/3147795/track

lauriii’s picture

Thanks for keeping to work on this one. I think we have to change the approach a little bit because it would be good to use Drupal's internal permission handling for this, instead of creating our own logic:

+++ b/subuser.module
@@ -265,6 +272,14 @@ function subuser_form_alter(&$form, &$form_state, $form_id) {
+      if (variable_get('flag_delete_subuser_options', 1)) {
LeoVe’s picture

Snehal,
The patch doesn't match the 7.x-2.x default module from version control and won't apply?
How to implement and test the patch from #7?

Thanks

jn2’s picture

The patch in #3 served my purposes - thanks very much! I don't need the configuration option.

However, what I can't fix is the email sent to the deleted user. The site regards this as a user deleting their own account, not a user deleted by an admin, and sends the Account cancelletion confirmation email. How can this email be disabled? Or how to get the site to regard the action as an admin deleting an account?

sdeathleader14’s picture

Hi, thanks for the patch #3 it solved my problem. i had the same problem that jn2 with "Account cancelletion confirmation email" so i edit the method "user_cancel_confirm_form_submit()" from "modules/user/user.pages.inc" and comment "_user_mail_notify", i know that is not a good solution but i solved it by now.

Greetings

krina.addweb’s picture

Status: Needs work » Needs review
lauriii’s picture

Status: Needs review » Needs work

This still needs work, see: #8