Ticket #5333: 5333-1.patch
File 5333-1.patch, 3.1 KB (added by , 11 years ago) |
---|
-
bp-blogs/bp-blogs-functions.php
diff --git a/bp-blogs/bp-blogs-functions.php b/bp-blogs/bp-blogs-functions.php index d032cfb..cf9b9a7 100644
a b function bp_blogs_update_option_blogdescription( $oldvalue, $newvalue ) { 247 247 add_action( 'update_option_blogdescription', 'bp_blogs_update_option_blogdescription', 10, 2 ); 248 248 249 249 /** 250 * Detect a change in post status, and initiate an activity update if necessary.250 * Detect a publish change in post status, and initiate an activity update if necessary. 251 251 * 252 252 * Posts get new activity updates when (a) they are being published, and (b) 253 253 * they have not already been published. This enables proper posting for … … add_action( 'update_option_blogdescription', 'bp_blogs_update_option_blogdescrip 259 259 * 260 260 * @param string $new_status New status for the post. 261 261 * @param string $old_status Old status for the post. 262 * @param object $post Post data.262 * @param WP_Post $post Post data. 263 263 */ 264 264 function bp_blogs_catch_published_post( $new_status, $old_status, $post ) { 265 265 … … function bp_blogs_catch_published_post( $new_status, $old_status, $post ) { 278 278 add_action( 'transition_post_status', 'bp_blogs_catch_published_post', 10, 3 ); 279 279 280 280 /** 281 * Detect a un-publish change in post status, and initiate an activity update if necessary. 282 * 283 * Posts have their activity updates removed when (a) they are being trashed or set to draft, and (b) they were already published. 284 * See #4090, #3746, #2546 for background. 285 * 286 * @since BuddyPress (2.0.0) 287 * 288 * @param string $new_status New status for the post. 289 * @param string $old_status Old status for the post. 290 * @param WP_Post $post Post data. 291 */ 292 function bp_blogs_catch_withdrawn_posts( $new_status, $old_status, $post ) { 293 294 // If the post wasn't already published, it won't have an activity stream item. 295 if ( 'publish' !== $old_status ) 296 return; 297 298 // Only handle if the post is being trashed or set back to draft. 299 if ( ! in_array( $new_status, array( 'draft', 'trash' ) ) ) 300 return; 301 302 bp_blogs_remove_post( $post->ID ); 303 } 304 add_action( 'transition_post_status', 'bp_blogs_catch_withdrawn_posts', 10, 3 ); 305 add_action( 'delete_post', 'bp_blogs_remove_post' ); 306 307 /** 281 308 * Record a new blog post in the BuddyPress activity stream. 282 309 * 283 310 * @param int $post_id ID of the post being recorded. … … add_action( 'remove_user_from_blog', 'bp_blogs_remove_blog_for_user', 10, 2 ); 595 622 * @param int $blog_id Optional. Defaults to current blog ID. 596 623 * @param int $user_id Optional. Defaults to the logged-in user ID. This param 597 624 * is currently unused in the function (but is passed to hooks). 625 * @param WP_Post $post The post's object which is being removed. Optional. 598 626 */ 599 627 function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) { 600 628 global $wpdb, $bp; … … function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) { 617 645 618 646 do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $user_id ); 619 647 } 620 add_action( 'delete_post', 'bp_blogs_remove_post' );621 648 622 649 /** 623 650 * Remove a blog comment activity item from the activity stream.