Skip to:
Content

BuddyPress.org

Changeset 3230


Ignore:
Timestamp:
09/02/2010 06:32:45 PM (16 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2613 props Paul Gibbs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-groups.php

    r3229 r3230  
    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;
     
    16301637        // Get the group object
    16311638        $group = new BP_Groups_Group( $group_id );
    1632 
    16331639        if ( !$group->delete() )
    16341640                return false;
    16351641
    1636         /* Delete all group activity from activity streams */
    1637         if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
     1642        // Delete all group activity from activity streams
     1643        if ( bp_is_active( 'activity' ) )
    16381644                bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component' => $bp->groups->id ) );
    1639         }
    16401645
    16411646        // Remove all outstanding invites for this group
     
    16451650        bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->slug );
    16461651
    1647         do_action( 'groups_delete_group', $group_id );
     1652        // Remove forum if component is active and current group has one
     1653        if ( function_exists( 'bp_forums_setup' ) && $group->enable_forum ) {
     1654                do_action( 'bbpress_init' );
     1655                bb_delete_forum( groups_get_groupmeta( $group_id, 'forum_id' ) );
     1656        }
     1657
     1658        do_action( 'groups_delete_group', $group_id);
    16481659
    16491660        return true;
Note: See TracChangeset for help on using the changeset viewer.