The calls to confirm_form in the following functions use the wrong API, and need to be rewritten.

_drupal_delete()
user_confirm_delete()

Comments

webernet’s picture

Status: Active » Needs review
StatusFileSize
new9.27 KB

Attached patch fixes user_confirm_delete() and removes _drupal_delete() and some nearby code which appears to be a remnant of the deletion API.

gábor hojtsy’s picture

Status: Needs review » Needs work

You introduce an associative array with the "description" key which will be a parse error. Also, are you sure that drupal_redirect() is not used elsewhere. Sure, it looks like a deletion API remaining, but still, it would be good to check.

webernet’s picture

Status: Needs work » Needs review
StatusFileSize
new9.25 KB

Copy paste error...

I searched for all three functions being removed and didn't find anything.

asimmonds’s picture

Title: Broken confirm forms » Broken user delete confirm form
StatusFileSize
new992 bytes

user_confirm_delete() requires a &$form_state parameter as it's called from drupal_get_form, also the old code had 'Delete' and 'Cancel' for it's options.

I've shifted the removal of the DAPI functions to http://drupal.org/node/156778 (Incomplete DAPI rollback), as IMO that issue is more suited to remove that code.

pwolanin’s picture

webernet says we also have this warning:

warning: Missing argument 1 for user_edit() in user.module on line 1690.

where arg 1 is form state

pwolanin’s picture

StatusFileSize
new6.91 KB

holy cow, what a mess.

I think this patch straightens out the menu callbacks and FAPI bits for this part of the user module. Note, as with this patch: http://drupal.org/node/166644 a form builder should never be calling drupal_set_title() or doing anything other than building the $form array.

pwolanin’s picture

note - some menu paths are changed by the patch. After applying the patch you need to rebuild your menu (easiest way is to enabe/disable a module). Test whether user accounts can be edited and deleted.

Also, the patch removes some use of raw $_POST carried over form pre-FAPI.

pwolanin’s picture

StatusFileSize
new6.92 KB

a couple comment and code-style cleanups caught by webernet.

webernet’s picture

Looks OK, tested OK.

pwolanin’s picture

StatusFileSize
new8.9 KB

note this patch looks bigger now because per request from chx it moves the code around a little to get a better grouping of the submit/validate functions with with relevant form builders.

Also adds a negative #weight to the 'Account' fieldset so it comes on top.

eaton’s picture

Status: Needs review » Reviewed & tested by the community

More readable, better arrangement of the code, and -- as an extra bonus -- it now works! Tested and approved.

gábor hojtsy’s picture

Title: Broken user delete confirm form » User editing forms cleanup (also fixes broken user delete confirm form)
Status: Reviewed & tested by the community » Fixed

Thanks for the cleanup! Committed!

Anonymous’s picture

Status: Fixed » Closed (fixed)