Skip to:

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's profile DJPaul Owned by: djpaul's profile DJPaul
Milestone: 1.2.6 Priority: normal
Severity: Version:
Component: Groups Keywords: has-patch, tested


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)

patch-2614.patch (1.4 KB) - added by DJPaul 14 years ago.
patch-2614-2.patch (2.8 KB) - added by DJPaul 14 years ago.

Download all attachments as: .zip

Change History (15)

#1 @DJPaul
14 years ago

  • Owner set to DJPaul
  • Status changed from new to assigned

on it

#2 @DJPaul
14 years ago

  • Keywords has-patch tested added

14 years ago


#4 @johnjamesjacoby
14 years ago

A few thoughts on this.

  1. Love your patches as of late. Really stepped up the quality of code.
  2. Should we flat out delete the entire group? Remember that doing so would destroy all forum data and user memberships with no undo.

#5 @DJPaul
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 @johnjamesjacoby
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 @DJPaul
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 @DJPaul
14 years ago

This assumes creator_id isn't updated when that person leaves the group (I can't check right now)?

#9 @johnjamesjacoby
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.

14 years ago


#10 @DJPaul
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.

#11 @johnjamesjacoby
14 years ago

New patch looks good and adds missing functionality.

I like it.

#12 @paulhastings0
14 years ago

  • Summary changed from Groups aren't removed when owning user's account is deleted to [patch] Groups aren't removed when owning user's account is deleted

#13 @johnjamesjacoby
14 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [3229]) Fixes #2614 props Paul Gibbs

Note: See TracTickets for help on using tickets.