Skip to:
Content

BuddyPress.org

Ticket #2613: patch-2613.patch

File patch-2613.patch, 1.5 KB (added by DJPaul, 15 years ago)

v1

  • bp-groups.php

     
    16201620        return true;
    16211621}
    16221622
     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 */
    16231630function groups_delete_group( $group_id ) {
    16241631        global $bp;
    16251632
     
    16271634        if ( !$bp->is_item_admin )
    16281635                return false;
    16291636
     1637        $forum_id = groups_get_groupmeta( $group_id, 'forum_id' );
     1638
    16301639        // Get the group object
    16311640        $group = new BP_Groups_Group( $group_id );
    1632 
    16331641        if ( !$group->delete() )
    16341642                return false;
    16351643
    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' ) )
    16381646                bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component' => $bp->groups->id ) );
    1639         }
    16401647
    16411648        // Remove all outstanding invites for this group
    16421649        groups_delete_all_group_invites( $group_id );
     
    16441651        // Remove all notifications for any user belonging to this group
    16451652        bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->slug );
    16461653
    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        }
    16481659
     1660        do_action( 'groups_delete_group', $group_id, $forum_id );
     1661
    16491662        return true;
    16501663}
    16511664