Opened 14 years ago
Closed 14 years ago
#2614 closed defect (bug) (fixed)
[patch] Groups aren't removed when owning user's account is deleted
Reported by: | DJPaul | Owned by: | DJPaul |
---|---|---|---|
Milestone: | 1.2.6 | Priority: | normal |
Severity: | Version: | ||
Component: | Groups | Keywords: | has-patch, tested |
Cc: |
Description
A user is a group(s) admin; when their user account is deleted, those group aren't removed from the database.
If those groups had only the one admin, on the group directory the total group count shows all groups (incl. those now with no admin) but in the loop, it iterates through the "real" groups (group has a 'total_member_count' record).
Attachments (2)
Change History (15)
#3
@
14 years ago
This bug was found by webgyrl and James Smith on the forum: http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/why-does-group-count-not-go-down-when-you-delete-group/
#4
@
14 years ago
A few thoughts on this.
- Love your patches as of late. Really stepped up the quality of code.
- Should we flat out delete the entire group? Remember that doing so would destroy all forum data and user memberships with no undo.
#5
@
14 years ago
The patch as it stands will only delete the group(s) if the user deletion would result in a group with no admins. We could block/warn about the delete user action from the BuddyPress admin menus if the user is the only admin in a group. However we can't do that from the WordPress dashboard.
I suppose we could add a WordPress Administrator user (which one? It's not always user_id=1) to the group as an alternative?
#6
@
14 years ago
Worst case scenario, a group with no admins can still be seen by super admins, and users can be promoted within if necessary.
The problem is not having a proper moderation layer in core the handle this appropriately.
What if we check the creator_id, and only delete groups this user created, where they are the only admin?
#7
@
14 years ago
That wouldn't work in cases where the group creator has promoted another user to admin, and then leaves the group, and then the site admin deletes the "new" group admin.
#8
@
14 years ago
This assumes creator_id isn't updated when that person leaves the group (I can't check right now)?
#9
@
14 years ago
creator_id is never adjusted after the group is created.
Seems we're backed into a corner then. I think the next set of options only get more complex from here...
Something like changing the 'Are you sure?' JS message box to a smarter deletion summary page with checkboxes on what data to destroy? Append 'Deleting this user will also delete the following: 2 Groups: %groupnames, 300 Activity Entries, 50 Friendships' etc etc...
That starts to get into 1.3 territory.
#10
@
14 years ago
v2 adds the creator_id check as discussed. After consideration, this will still capture the majority of spam groups, which will be a good enhancement for the next release. We can leave the ticket open for a more robust solution for 1.3.
on it