Skip to:
Content

BuddyPress.org

Changeset 4562


Ignore:
Timestamp:
06/24/2011 08:17:29 PM (11 years ago)
Author:
boonebgorges
Message:

Ensures that activity items corresponding to all child posts are deleted when the entire topic thread is deleted. Fixes #3300 for 1.2 branch

File:
1 edited

Legend:

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

    r4066 r4562  
    21712171    global $bp;
    21722172
     2173    // Before deleting the thread, get the post ids so that their activity items can be deleted
     2174    $posts = bp_forums_get_topic_posts( array( 'topic_id' => $topic_id, 'per_page' => -1 ) );
     2175
    21732176    if ( bp_forums_delete_topic( array( 'topic_id' => $topic_id ) ) ) {
    2174         /* Delete the activity stream item */
    2175         if ( function_exists( 'bp_activity_delete' ) ) {
     2177        do_action( 'groups_before_delete_group_forum_topic', $topic_id );
     2178
     2179        // Delete the activity stream items
     2180        if ( bp_is_active( 'activity' ) ) {
     2181            // The activity item for the initial topic
    21762182            bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
     2183           
     2184            // The activity item for each post
     2185            foreach ( (array)$posts as $post ) {
     2186                bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post->post_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post' ) );
     2187            }
    21772188        }
    21782189
Note: See TracChangeset for help on using the changeset viewer.