Skip to:
Content

BuddyPress.org

Changeset 9837


Ignore:
Timestamp:
05/04/2015 07:31:24 PM (11 years ago)
Author:
imath
Message:

Make sure tracked post types registered using the bp_blogs_record_post_post_types filter will have the same activity tracking arguments than the post post type.

Since 2.2.0, and the introduction of the custom post types activities feature, when a post type was registered using the bp_blogs_record_post_post_types filter it had specific tracking arguments. It introduced some inconsistency as soon as the filter bp_blogs_record_comment_post_types was also used to track comments about this post type and when the activity/comment syncing feature was on.

From now on, post types registering to Site tracking using the filter bp_blogs_record_post_post_types will automatically get the same tracking arguments than the post post type to fix this inconsistency.

Props shanebp, boonebgorges

Fixes #6306

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-loader.php

    r9819 r9837  
    8686
    8787                        /**
    88                          * Filters the post types to track for the Blog component.
     88                         * Filters the post types to track for the Blogs component.
    8989                         *
    9090                         * @since BuddyPress (1.5.0)
     91                         * @deprecated BuddyPress (2.3.0)
    9192                         *
    9293                         * @param array $value Array of post types to track.
    … …  
    298299         * @see bp_activity_get_post_type_tracking_args() for information on parameters.
    299300         */
    300         public function post_tracking_args( $params = array(), $post_type = 0 ) {
    301                 if ( 'post' != $post_type ) {
     301        public function post_tracking_args( $params = null, $post_type = 0 ) {
     302                /**
     303                 * Filters the post types to track for the Blogs component.
     304                 *
     305                 * @since BuddyPress (1.5.0)
     306                 * @deprecated BuddyPress (2.3.0)
     307                 *
     308                 * Make sure plugins still using 'bp_blogs_record_post_post_types'
     309                 * to track their post types will generate new_blog_post activities
     310                 * See https://buddypress.trac.wordpress.org/ticket/6306
     311                 *
     312                 * @param array $value Array of post types to track.
     313                 */
     314                $post_types = apply_filters( 'bp_blogs_record_post_post_types', array( 'post' ) );
     315                $post_types_array = array_flip( $post_types );
     316
     317                if ( ! isset( $post_types_array[ $post_type ] ) ) {
    302318                        return $params;
    303319                }
Note: See TracChangeset for help on using the changeset viewer.