Skip to:
Content

BuddyPress.org

Ticket #6795: 6795.patch

File 6795.patch, 1.9 KB (added by imath, 9 years ago)
  • src/bp-activity/bp-activity-actions.php

    diff --git src/bp-activity/bp-activity-actions.php src/bp-activity/bp-activity-actions.php
    index 7d17133..7ec5e39 100644
    function bp_activity_catch_transition_post_type_status( $new_status, $old_status 
    798798                // An edit of an existing post should update the existing activity item.
    799799                if ( $new_status == 'publish' ) {
    800800                        bp_activity_post_type_update( $post );
     801
     802                // Allow plugins to eventually deal with other post stati
     803                } else {
     804                        /**
     805                         * Fires when editing the post and the new status is not 'publish'.
     806                         *
     807                         * This is a variable filter that is dependent on the post type
     808                         * being untrashed.
     809                         *
     810                         * @since 2.5.0
     811                         *
     812                         * @param WP_Post $post Post data.
     813                         * @param string $new_status New status for the post.
     814                         * @param string $old_status Old status for the post.
     815                         */
     816                        do_action( 'bp_activity_post_type_edit_' . $post->post_type, $post, $new_status, $old_status );
    801817                }
    802818
    803819                return;
    function bp_activity_catch_transition_post_type_status( $new_status, $old_status 
    828844        } elseif ( 'publish' === $old_status ) {
    829845                // Some form of pending status - only remove the activity entry.
    830846                bp_activity_post_type_unpublish( $post->ID, $post );
     847
     848        // For any other cases, allow plugins to eventually deal with it
     849        } else {
     850                /**
     851                 * Fires when the old and the new post status are not 'publish'.
     852                 *
     853                 * This is a variable filter that is dependent on the post type
     854                 * being untrashed.
     855                 *
     856                 * @since 2.5.0
     857                 *
     858                 * @param WP_Post $post Post data.
     859                 * @param string $new_status New status for the post.
     860                 * @param string $old_status Old status for the post.
     861                 */
     862                do_action( 'bp_activity_post_type_transition_status_' . $post->post_type, $post, $new_status, $old_status );
    831863        }
    832864}
    833865add_action( 'transition_post_status', 'bp_activity_catch_transition_post_type_status', 10, 3 );