Skip to:
Content

BuddyPress.org

Ticket #6777: 6777.patch

File 6777.patch, 2.1 KB (added by imath, 10 years ago)
  • src/bp-activity/bp-activity-functions.php

    diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
    index e6c101d..62fcbb1 100644
    function bp_activity_set_post_type_tracking_args( $post_type = '', $args = array 
    422422        foreach ( array( 'bp_activity_admin_filter', 'bp_activity_front_filter', 'bp_activity_new_post', 'bp_activity_new_post_ms' ) as $label_type ) {
    423423                if ( ! empty( $args[ $label_type ] ) ) {
    424424                        $wp_post_types[ $post_type ]->labels->{$label_type} = $args[ $label_type ];
    425                         unset( $args[ $post_type ] );
     425                        unset( $args[ $label_type ] );
    426426                }
    427427        }
    428428
  • tests/phpunit/testcases/activity/functions.php

    diff --git tests/phpunit/testcases/activity/functions.php tests/phpunit/testcases/activity/functions.php
    index 2fb7a2a..d112af6 100644
    Bar!'; 
    10881088        }
    10891089
    10901090        /**
     1091         * @group bp_activity_set_post_type_tracking_args
     1092         * @group activity_tracking
     1093         */
     1094        public function test_bp_activity_set_post_type_tracking_args_check_post_type_global() {
     1095                $labels = array(
     1096                        'bp_activity_admin_filter' => 'New Foo',
     1097                        'bp_activity_front_filter' => 'Foos',
     1098                );
     1099
     1100                $bp_activity_args = array(
     1101                        'action_id'    => 'new_foo',
     1102                        'contexts'     => array( 'activity' ),
     1103                        'position'     => 40,
     1104                );
     1105
     1106                register_post_type( 'foo', array(
     1107                        'labels'      => $labels,
     1108                        'supports'    => array( 'buddypress-activity' ),
     1109                        'bp_activity' => $bp_activity_args
     1110                ) );
     1111
     1112                $register_bp_activity = get_post_type_object( 'foo' )->bp_activity;
     1113                _unregister_post_type( 'foo' );
     1114
     1115                //var_dump( $register_bp_activity );
     1116
     1117                register_post_type( 'foo', array(
     1118                        'label'       => 'foo',
     1119                        'supports'    => array( 'buddypress-activity' ),
     1120                ) );
     1121
     1122                bp_activity_set_post_type_tracking_args( 'foo', $labels + $bp_activity_args );
     1123
     1124                $set_bp_activity = get_post_type_object( 'foo' )->bp_activity;
     1125                _unregister_post_type( 'foo' );
     1126
     1127                $this->assertSame( $set_bp_activity, $register_bp_activity );
     1128        }
     1129
     1130        /**
    10911131         * @group bp_activity_new_comment
    10921132         * @group cache
    10931133         */