[buddypress-trac] [BuddyPress] #2773: Add "pre-delete" hooks to groups component

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Nov 30 22:21:42 UTC 2010


#2773: Add "pre-delete" hooks to groups component
--------------------------------+-------------------------------------------
 Reporter:  vtowel              |       Owner:       
     Type:  enhancement         |      Status:  new  
 Priority:  normal              |   Milestone:  1.3  
Component:  Groups              |     Version:  1.2.5
 Keywords:  plugins, extending  |  
--------------------------------+-------------------------------------------
 When a group is deleted, the only hook available in
 {{{groups_delete_group}}} is triggered ''after'' the group and all its
 metadata is deleted. So any group plugins which require access to group
 information (e.g., for custom cleanup) are denied it.

 Some plugins, such as one I am writing to add group-specific Google Docs
 support, require group metadata to look up the group's associated Google
 Docs folder ID before deletion. I had to get around it by cumbersomely
 storing that data in the WP options table instead. Similarly, I needed to
 hook into {{{groups_remove_data_for_user}}} to unshare the Google Docs
 folder for each of the groups that user was subscribed to, but encountered
 the same problem because the user's group memberships had already been
 deleted before my action was triggered.

 There may be other places in BP where a "pre-delete" hook would be useful,
 but for sure in {{{groups_delete_group}}} and
 {{{groups_remove_data_for_user}}}.

 WordPress solved this problem by supporting both a {{{delete_xyz}}} hook
 (which occurs before deletion of xyz) and a {{{deleted_xyz}}} hook (which
 occurs after deletion of xyz). Perhaps BuddyPress components could mimic
 WordPress in this way.

 Alternatively, the current delete hooks could just be moved above the SQL
 delete commands - but I'm not sure what BP developers would prefer to do.

-- 
Ticket URL: <https://trac.buddypress.org/ticket/2773>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list