As the title says - the advuser.module allows for filtering of users and deletion of multiple users at a time. When users are deleted this way the usernode nodes are not deleted.

Comments

fago’s picture

Title: advuser.module does not remove usernode nodes when users are deleted » hook_user() not invoked when users are deleted
Project: Usernode » Advanced User

the advuser module should invoke hook_user() when it deletes an user.

mcurry’s picture

Title: hook_user() not invoked when users are deleted » hook_user() not invoked when users are deleted - doesn't play nice with usernode module
Assigned: Unassigned » mcurry
Category: bug » feature
Priority: Normal » Critical

I consider this a feature request - and it's a critical one.

mcurry’s picture

It appears that is similar to http://drupal.org/node/73770.

Is there a recommended/"best practice" method of handling user deletion? Seems like this is error-prone if each module doing deletion needs to implement similar code.

Also, I see that all current versions of advuser.module commited to CVS invoke the hook_user hook on deletion. (see code below). This should result in a call to usernode's hook_user hook.

function advuser_multiple_delete_confirm_submit($form_id, $edit) {
  if ($edit['confirm']) {
    foreach ($edit['users'] as $uid => $value) {
      $account = user_load(array('uid'=>$uid));
      db_query('DELETE FROM {users} WHERE uid = %d', $account->uid);
      db_query('DELETE FROM {sessions} WHERE uid = %d', $account->uid);
      db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
      db_query('DELETE FROM {authmap} WHERE uid = %d', $account->uid);
      watchdog('user', t('Deleted user: %name %email.', array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', '<'. $account->mail .'>'))), WATCHDOG_NOTICE);
      drupal_set_message(t('The account has been deleted.'));
      module_invoke_all('user', 'delete', $edit, $account);
    }
    drupal_set_message(t('The items have been deleted.'));
  }
  drupal_goto('admin/user/advuser');
}

So, what else is the module supposed to do on deletion? What's missing?

mcurry’s picture

Status: Active » Fixed

I'm marking this fixed, since no one has responded. All versions in CVS have the proper code to invoke hook_user() with the 'delete' op. Please correct me if you've tried the latest version of this module, and it still doesn't work.

Anonymous’s picture

Status: Fixed » Closed (fixed)