Closed (fixed)
Project:
Signup
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2009 at 21:50 UTC
Updated:
25 Oct 2010 at 22:50 UTC
Jump to comment: Most recent file
We are allowing sign-ups for an event. We had about 40 signups and I just created a user and deleted the user and it cancelled all the signups? I have no idea what happened. Can someone please help me out. Is there anyway I can get the users signed up back. It's extremely important. The site is www.NationalCleaningExpo.com the event was Prattville Alabama.
Why would this happen if I just deleted a user? This user was not associated with any of these signups and was created after the signups.
Someone please help me.
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | signup_delete_anonymous_signups.patch | 945 bytes | weseze |
| #18 | signup_delete_anonymous_signups.patch | 945 bytes | weseze |
| #11 | signup_delete_anonymous_signups.patch | 687 bytes | ezra-g |
| #10 | signup_delete_anonymous_signups.patch | 1.2 KB | ezra-g |
Comments
Comment #1
dwwIs there anyway I can get the users signed up back.
From your database backup if you have one. Otherwise no.
If what you say is true, it's a (nasty) bug. However, I thought we already fixed this bug... ;)
#321653: guest "cancel signup" deletes him from all signups.
#233512: Deleted User needs to be removed from the log
Can anyone else easily reproduce this?
Comment #2
dwwI just tried to reproduce this and couldn't.
- Cean D6 test site
- I added a "test1" user
- had that user and 3 others signup for an event
- viewed the signup list and saw 4 users signed up
- deleted the "test1" user
- viewed the signup list and saw 3 users signed up
Can you reproduce this on your test site?
Can you reproduce this on a clean D6 test site with nothing but core and signup.module?
Can you provide detailed information about how to reproduce it, including versions of all installed modules and any signup-related configuration?
Given that I can't reproduce it myself, I don't currently think there's a bug in the code, moving this back to a support request.
Comment #3
CleaningExpo commentedIt just happened to me again. I'm not going to lie about this. When I get time I will produce a video.
Comment #4
dwwI'm not accusing you of lying, nor am I asking for a video. ;) I simply stated the facts from my end: you've reported a problem, I showed you the detailed steps of how I tried to reproduce it (and couldn't). I asked some very specific questions you could answer to make it possible for me to understand the problem you're having and find the bug (if any) that's causing it. Please just answer my questions if you're interested in resolving this. Thanks.
Comment #5
dwwBased on #467042: Anonymous signups cancelled when deleting a user (now marked duplicate of this), perhaps the bug only shows up for anonymous signups. Re-reading this thread, CleaningExpo never specified auth vs. anon signups, and I clearly only tried with auth signups in my testing for comment #2...
Given another independent report, and the likelihood that this is a real bug, and given that it's a data loss bug, I'm bumping this back to active + critical...
@CleaningExpo, if you're still reading this, can you confirm that it was anonymous signups that were canceled when you delete a user?
Comment #6
katiusha commentedI've experienced this bug when I have both anonymous and non-anonymous signups to the next event in the event queue. I tried to delete various users, both signed up and not signed up for this particular event, and the result is the same, the anonymous signups are all cancelled, the ones made by registered users are ok.
Might it be related to the message I get when I try to delete a user that all the posts of the deleted user will be assigned to anonymous?... Maybe the uid is set to that of the anonymous user when this happens, and when the signup_user hook is called it deletes signups with the anonymous uid?...
Comment #7
BenK commentedI've just experienced the exact same problem. I went to delete a user who had never signed up for anything and upon confirmation of that user's deletion, I got a long page full of messages saying numerous signups had been deleted.
This deleted all anonymous signups across my entire site (which was over 500 signups). Luckily, I had exported that list somewhat recently so I only lost a few dozen names.
Obviously, this type of loss of data is pretty scary. At this point, I'm afraid to delete any user.
Thanks,
Ben
Comment #8
BenK commentedOne more thing: I wanted to point out that all of my authenticated signups seemed to be fine. This issue appears to only effect anonymous signups.
--Ben
Comment #9
dwwYup, this is critical. Giving a more accurate title... Hopefully shouldn't be too hard to fix. Definitely before rc4 goes out (#363238: Release signup 6.x-1.0-rc4). Anyone feel like trying to debug? (My hands are very full right now). Also, can anyone test this on D5? Thanks!
Comment #10
ezra-g commentedI put some debug messages in and found that on the user tab, the uid was not correctly being passed to the SELECT * FROM {signup_log} query (newsflash!). This patch corrects the offending line.
Comment #11
ezra-g commentedthis patch is without the debug messages ;).
Comment #12
dwwLooks like an undocumented API change between D5 and D6 core. :/ Alas. Reviewed, tested, and committed to HEAD and DRUPAL-6--1. Thanks!
Comment #13
moshe weitzman commentedI am curious what the API change was.
Comment #14
dww@moshe: See patch #11. The contents of the $edit argument passed into hook_user() are totally different between D5 and D6.
Comment #15
dh@tbed.org commentedI don't see a new dev version of the signup module that might include this patch given the date of this issue. I'm not equipped to do a patch, so I need to wait for the next version of signup. Do you know when we can expect it? Thanks!
Comment #17
weseze commentedI would like to reopen this, becaus I believe this is not 100% fixed yet. I have a scenario where this bug still persists.
With Drupal core this fix works just fine, but with (some) add-on modules it doesn't work. I've lowered the priority to normal since it now only affects some very specific add-on modules.
First, the fix in the patch:
Now the bit that was a fix for this problem, but I think isn't.
The problem is that this fix relies on the $edit array to be correctly set. If add-on modules use the user_delete hook function the edit-array will NOT be properly set. I've checked this with some add-on modules (not many use this hook function) and they all implement it like this:
Take a look at the API documentation: http://api.drupal.org/api/function/user_delete/6
The signup_user function is (in this case) called with a blank $edit-array.
I think that the $user object would be a more reliable source for getting the uid, as it is loaded in the user_delete function:
I've not made a patch because I'm not sure that using $user is more reliable then using $edit.
I currently have Signup running with this small change on all of our sites. If any problems arrise I will report here.
Any more ideas on this? Any other functions/hooks that are connected?
Comment #18
weseze commentedThis is the patch containing the changes I made. I've added an extra check on the $uids array to make sure it is an array and that contains some data.
Comment #19
flaviovs commentedI'm in the process of using this module on a project I'm currently working on, and just stumbled upon this issue.
I didn't dig into the code yet, but a simple question popped up on my head when looking at the code above: since it doesn't make sense to delete the anonymous "user", what about skipping signup cancellation if we find the anonymous user uid? E.g.:
Shouldn't this be enough to solve this problem?
Comment #20
weseze commentedNo it won't...
Preventing the deletion of the anonymous user is a very good idea, but won't solve the problem I still see.
The problem is that the $uid used in the module might not have been set at all because it is taken from the $edit array. Other modules invoking the user_delete function don't set this $edit array. So the $uid will always be blank (or 0) in that case. Even if a valid user is being deleted! The $uid you can get from the $user object, which is also passed in to the signup_user function, is always correctly set.
The patch I made changes the logic to use the $user object instead of the $edit array.
I have got this patch running on all of our sites and since then the signups are working correctly. I have got 2 modules enabled that use the user_delete hook and all anonymous signups were deleted when this hook was called with a valid non-anonymous user... Offcourse, if you don't use any extra modules that invoke the user_delete function everything will work correctly to. (and very few modules use this hook)
Do you understand the problem now? Or am I not explaining it good enough?
Comment #21
dww#18 looks pretty good to me. Yeah, using $user is probably better.
However, we should swap the order of the is_array() and !empty() checks, to ensure we don't try to test is_array() on a variable that doesn't exist.
Thanks for the fix!
Comment #22
weseze commentedhas this been comitted yet?
Comment #23
gregstout commentedI seems like it has not been committed. Need to apply this patch manually.
I have confirmed that this does solve the problem of canceling anonymous user signups on my site.
Comment #24
weseze commentedI've got my patch from #18 running on 11 websites atm and no more problems with the anonymous signups being cancelled.
Anyone else using the patch?
Comment #25
dwwStill needs work for #21. Then this can go in. Sorry for the delays! I've got too many irons in the fire these days... :/
Comment #26
weseze commentedcorrected patch:
Comment #27
dwwGreat, thanks. If anyone else can test this, it'd be great. I'm at a conference all weekend and won't really have much time for Drupal, but if this can be tested and RTBC by early next week, I can get this into CVS.
Thanks!
-Derek
Comment #28
ezra-g commentedUsing the $account argument rather than taking it from the $edit/form values is the right solution here. Thanks for pointing this out!
Our hook_user() implementation should really call the third argument &$account, rather than &$user per best practices and http://api.drupal.org/api/function/hook_user/6 . I combined this change with yours, tested, and committed: http://drupal.org/cvs?commit=434716
Thanks!