Ticket #2613: patch-2613.patch
File patch-2613.patch, 1.5 KB (added by , 15 years ago) |
---|
-
bp-groups.php
1620 1620 return true; 1621 1621 } 1622 1622 1623 /** 1624 * Delete a group and all of its associated meta 1625 * 1626 * @global object $bp BuddyPress global settings 1627 * @param int $group_id 1628 * @since 1.0 1629 */ 1623 1630 function groups_delete_group( $group_id ) { 1624 1631 global $bp; 1625 1632 … … 1627 1634 if ( !$bp->is_item_admin ) 1628 1635 return false; 1629 1636 1637 $forum_id = groups_get_groupmeta( $group_id, 'forum_id' ); 1638 1630 1639 // Get the group object 1631 1640 $group = new BP_Groups_Group( $group_id ); 1632 1633 1641 if ( !$group->delete() ) 1634 1642 return false; 1635 1643 1636 / * Delete all group activity from activity streams */1637 if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {1644 // Delete all group activity from activity streams 1645 if ( bp_is_active( 'activity' ) ) 1638 1646 bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component' => $bp->groups->id ) ); 1639 }1640 1647 1641 1648 // Remove all outstanding invites for this group 1642 1649 groups_delete_all_group_invites( $group_id ); … … 1644 1651 // Remove all notifications for any user belonging to this group 1645 1652 bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->slug ); 1646 1653 1647 do_action( 'groups_delete_group', $group_id ); 1654 // Remove forum 1655 if ( $forum_id ) { 1656 do_action( 'bbpress_init' ); 1657 bb_delete_forum( $forum_id ); 1658 } 1648 1659 1660 do_action( 'groups_delete_group', $group_id, $forum_id ); 1661 1649 1662 return true; 1650 1663 } 1651 1664