Changeset 4561
- Timestamp:
- 06/24/2011 08:14:09 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-forums.php
r4348 r4561 188 188 } 189 189 190 /** 191 * Handles the forum topic deletion routine 192 * 193 * @package BuddyPress 194 * 195 * @uses bp_activity_delete() to delete corresponding activity items 196 * @uses bp_forums_get_topic_posts() to get the child posts 197 * @uses bp_forums_delete_topic() to do the deletion itself 198 * @param int $topic_id The id of the topic to be deleted 199 * @return bool True if the delete routine went through properly 200 */ 190 201 function groups_delete_group_forum_topic( $topic_id ) { 191 202 global $bp; 203 204 // Before deleting the thread, get the post ids so that their activity items can be deleted 205 $posts = bp_forums_get_topic_posts( array( 'topic_id' => $topic_id, 'per_page' => -1 ) ); 192 206 193 207 if ( bp_forums_delete_topic( array( 'topic_id' => $topic_id ) ) ) { 194 208 do_action( 'groups_before_delete_group_forum_topic', $topic_id ); 195 209 196 // Delete the activity stream item 197 if ( bp_is_active( 'activity' ) ) 210 // Delete the activity stream items 211 if ( bp_is_active( 'activity' ) ) { 212 // The activity item for the initial topic 198 213 bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) ); 214 215 // The activity item for each post 216 foreach ( (array)$posts as $post ) { 217 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' ) ); 218 } 219 } 199 220 200 221 do_action( 'groups_delete_group_forum_topic', $topic_id );
Note: See TracChangeset
for help on using the changeset viewer.