Changeset 8073 for trunk/bp-blogs/bp-blogs-functions.php
- Timestamp:
- 03/06/2014 09:02:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-functions.php
r8042 r8073 260 260 * See #4090, #3746, #2546 for background. 261 261 * 262 * @since BuddyPress ( 1.9.0)262 * @since BuddyPress (2.0.0) 263 263 * 264 264 * @param string $new_status New status for the post. … … 266 266 * @param object $post Post data. 267 267 */ 268 function bp_blogs_catch_ published_post( $new_status, $old_status, $post ) {269 270 // Only record published posts271 if ( 'publish' !== $new_status ) {268 function bp_blogs_catch_transition_post_status( $new_status, $old_status, $post ) { 269 270 // Do nothing for edits 271 if ( $new_status === $old_status ) { 272 272 return; 273 273 } 274 274 275 // Don't record edits (publish -> publish) 276 if ( 'publish' === $old_status ) { 277 return; 278 } 279 280 return bp_blogs_record_post( $post->ID, $post ); 281 } 282 add_action( 'transition_post_status', 'bp_blogs_catch_published_post', 10, 3 ); 275 // Publishing a previously unpublished post 276 if ( 'publish' === $new_status ) { 277 return bp_blogs_record_post( $post->ID, $post ); 278 279 // Unpublishing a previously published post 280 } else if ( 'publish' === $old_status ) { 281 return bp_blogs_remove_post( $post->ID ); 282 } 283 } 284 add_action( 'transition_post_status', 'bp_blogs_catch_transition_post_status', 10, 3 ); 283 285 284 286 /**
Note: See TracChangeset
for help on using the changeset viewer.