I've completed the backport of this API. To work on this I've created a new cvs branch DRUPAL-6--2 and committed. I don't to make a new release of this yet because people could get confused trying to upgrade form 6.x-1.x to 6.x-2.x, and they are two
very different approaches.

DRUPAL-6--2 mimics exactly the way Drupal7 handle user cancellation (including user -> edit -> delete, and admin/user/user bulk operations). The only difference is that node, content, and other modules react to hook_user_cancel and hook_user_delete in D7, and in D6 these two hooks are implemented in user_delete.

There is a lot of code and things must be splitted, but it is working in both ways : foreach() loop when there are no more than 10 items to delete/update (nodes or comments) and in batch process when there are more than 10.

I did manual testing and extensive testing with devel-generate for using the batch api. Anyway, the module still needs testing when interacting with other modules (a required test is using another module that uses comment's module hooks).

There are a few @todos and @tasks in the .module file but could be solved easily. I'm putting the module in a live site for real test and will try to comment any issue I find.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ilo’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

put this in the right place.

ilo’s picture

Sandbox is no longer active.

chuckbar77’s picture

subscribing

DamienMcKenna’s picture

Title: backport D7 user cancel API to Drupal 6 » Backport D7 user cancel API to Drupal 6
Issue summary: View changes
Status: Active » Needs review

This has a number of improvements:

  • Coding standards improvements, especially comment formatting and removal of erroneous linebreaks between functions.
  • Added a README.txt file.
  • Added variable_del() calls to hook_uninstall().
  • Moved user_delete_cancel_confirm() to user_delete.pages.inc.

I've not tested this yet, but I did at lest run it through a lint test =)

DamienMcKenna’s picture

FileSize
30.74 KB

oh yeah, the patch.

Status: Needs review » Needs work

The last submitted patch, 5: user_delete-n935120-4.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review

The patch seemed to fail because the D6 Simpletest patch couldn't be applied?

DamienMcKenna’s picture

FileSize
0 bytes

Ah, user_delete_access() was a duplicate function, so I renamed it to user_delete_delete_access().

Status: Needs review » Needs work

The last submitted patch, 8: user_delete-n935120-8.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
31.27 KB

It'd help if I'd remember to create the patch correctly.

DamienMcKenna’s picture

Honestly I think it'd be better to add these options to the existing user settings page (admin/user/settings).

DamienMcKenna’s picture

FileSize
39.32 KB

This patch moves the new settings into the main user settings form.

The last submitted patch, 10: user_delete-n935120-10.patch, failed testing.

DamienMcKenna’s picture

Status: Needs review » Needs work

This needs a little further work, after the user goes through and confirms the account to be deleted, at the end of the batch process the user is dumped at the batch?id=[id]&op=finished page with an "Access denied" message.

The last submitted patch, 12: user_delete-n935120-12.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
1.76 KB

I appear to have resolved the problem of the unwanted error showing by adding a drupal_goto() to _user_delete_cancel().

DamienMcKenna’s picture

FileSize
39.86 KB

This is the correct patch.

The last submitted patch, 16: user_delete-n935120-16.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 17: user_delete-n935120-17.patch, failed testing.

DamienMcKenna’s picture

FYI right now the messages are not displayed to the end user, so they get bounced back to the front page with no confirmation their account is gone. This is obviously not ideal.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
37.52 KB

This fixes the calling of hook_comment in _user_delete_comment_save().

Status: Needs review » Needs work

The last submitted patch, 21: user_delete-n935120-21.patch, failed testing.

DamienMcKenna’s picture

FYI I'm personally giving up trying to get v2 to work correctly, every time I run it the user is redirected to the 'finished' batch page and presented with a 403 error. v1 works well enough, just needs a static "your account has been deleted' page added.