Global flags are entirely reset after deleting a user.

To recreate the problem create a new global flag on a node, flag a piece of dummy node content and then delete a dummy user. Now revisit the previously flagged dummy node and the Global flag will now be reset to its default state.

Not sure what other information I can provide, we use Content Profile which means that when users are deleted so if their profile node, but please let me know if you require something...

edit: Noticed that a global flag will use uid "0" in flag_content, I can build this up by flagging lots of content around the system, as soon as I delete a user - all the rows in flag_content with uid of "0" are deleted.

I believe the below is responsible.
// Delete any remaining flags this user had as an anonymous user.
db_query("DELETE FROM {flag_content} WHERE uid = 0 AND sid = %d", flag_get_sid(0));

Comments

westie’s picture

Issue summary: View changes

update to ask if any other info is required

baff’s picture

I have a similar problem. I have a flag wich marks an add as bold. From time to time all flags are reset. Very bad. This time it happend when I edited a view and added a filter. After Saving the view all flags were reset (not sure if this has anything to do with it ...). I am not able to reproduce as it happens not too often.

Is there a way to log which process is responsible for resetting the flags?

joachim’s picture

I can't see this code anywhere in the 6.x-2.x code:

 // Delete any remaining flags this user had as an anonymous user.
db_query("DELETE FROM {flag_content} WHERE uid = 0 AND sid = %d", flag_get_sid(0));

Can anyone reproduce this?

It doesn't seem to be a problem on 7, using the ' Delete the account and its content. ' method.

joachim’s picture

Issue summary: View changes

added what i think the problem is

stevenx’s picture

Issue summary: View changes

I can confirm this bug even in Drupal 7 running with 7.x-3.2+7-dev version of flags

stevenx’s picture

this related issue here in D7 fixes the problem!
https://drupal.org/comment/8460769#comment-8460769