Skip to:
Content

BuddyPress.org

Changeset 11256


Ignore:
Timestamp:
11/28/2016 10:33:55 PM (4 years ago)
Author:
djpaul
Message:

Fix incorrect remove_action and remove_filter usage for WordPress 4.7.

remove_action and remove_filter formally accepted a fourth parameter until WP 4.7; it's only with the introduction of the WP_Hook class that the function signature changed. Prior to WP 4.7, the fourth parameter was unused, so it does no harm to remove it and tidy things up.

Fixes #7318

Props ketuchetan

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-admin.php

    r10882 r11256  
    394394                     * which contains one of these listed keys.
    395395                     */
    396                     remove_action( 'bp_activity_before_save', 'bp_activity_check_moderation_keys', 2, 1 );
    397                     remove_action( 'bp_activity_before_save', 'bp_activity_check_blacklist_keys',  2, 1 );
     396                    remove_action( 'bp_activity_before_save', 'bp_activity_check_moderation_keys', 2 );
     397                    remove_action( 'bp_activity_before_save', 'bp_activity_check_blacklist_keys', 2 );
    398398
    399399                    bp_activity_mark_as_ham( $activity );
  • trunk/src/bp-activity/bp-activity-filters.php

    r11008 r11256  
    604604
    605605    // Remove the temporary filter.
    606     remove_filter( 'bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1 );
     606    remove_filter( 'bp_get_activity_css_class', 'bp_activity_newest_class', 10 );
    607607
    608608    if ( ! empty( $newest_activities['last_recorded'] ) ) {
  • trunk/src/bp-activity/bp-activity-functions.php

    r11168 r11256  
    14461446
    14471447    // Remove the filter for future activity items.
    1448     remove_filter( 'bp_activity_generate_action_string', $actions->{$activity->component}->{$activity->type}['format_callback'], 10, 2 );
     1448    remove_filter( 'bp_activity_generate_action_string', $actions->{$activity->component}->{$activity->type}['format_callback'], 10 );
    14491449
    14501450    return $action;
     
    33223322    // If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity.
    33233323    if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
    3324         remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 4, 1 );
     3324        remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 4 );
    33253325
    33263326        // Build data package for Akismet.
     
    33693369    // If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity.
    33703370    if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
    3371         remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 4, 1 );
     3371        remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 4 );
    33723372
    33733373        // Build data package for Akismet.
  • trunk/src/bp-blogs/bp-blogs-activity.php

    r11237 r11256  
    548548
    549549        // Use comments_open().
    550         remove_filter( 'comments_open', 'bp_comments_open', 10, 2 );
     550        remove_filter( 'comments_open', 'bp_comments_open', 10 );
    551551        $open = comments_open( $activity->secondary_item_id );
    552552        add_filter( 'comments_open', 'bp_comments_open', 10, 2 );
     
    807807
    808808    // Prevent separate activity entry being made.
    809     remove_action( 'comment_post', 'bp_activity_post_type_comment', 10, 2 );
     809    remove_action( 'comment_post', 'bp_activity_post_type_comment', 10 );
    810810
    811811    // Handle multisite.
     
    971971
    972972    // No need to edit the activity, as it's the activity who's updating the comment
    973     remove_action( 'transition_comment_status',     'bp_activity_transition_post_type_comment_status', 10, 3 );
    974     remove_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment',          10, 4 );
     973    remove_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10 );
     974    remove_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment', 10 );
    975975
    976976    if ( 1 === $activity->is_spam && 'spam' !== $post_comment_status ) {
  • trunk/src/bp-core/admin/bp-core-admin-functions.php

    r11179 r11256  
    11421142    $loader = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
    11431143
    1144     remove_action( "after_plugin_row_{$loader}", 'wp_plugin_update_row', 10, 2 );
     1144    remove_action( "after_plugin_row_{$loader}", 'wp_plugin_update_row', 10 );
    11451145    add_action( "after_plugin_row_{$loader}", 'bp_core_admin_php52_plugin_row', 10, 2 );
    11461146}
  • trunk/src/bp-core/bp-core-functions.php

    r11121 r11256  
    23732373    }
    23742374
    2375     remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
     2375    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 );
    23762376}
    23772377add_action( 'bp_init', 'bp_remove_adjacent_posts_rel_link' );
  • trunk/src/bp-core/classes/class-bp-attachment.php

    r10899 r11256  
    274274        // Restore WordPress Uploads data.
    275275        if ( ! empty( $upload_dir_filter ) ) {
    276             remove_filter( 'upload_dir', $upload_dir_filter, 10, $this->upload_dir_filter_args );
     276            remove_filter( 'upload_dir', $upload_dir_filter, 10 );
    277277        }
    278278
    279279        // Remove the pre WordPress 4.0 static filter.
    280         remove_filter( 'wp_handle_upload_prefilter', array( $this, 'validate_upload' ), 10, 1 );
     280        remove_filter( 'wp_handle_upload_prefilter', array( $this, 'validate_upload' ), 10 );
    281281
    282282        // Finally return the uploaded file or the error.
  • trunk/src/bp-core/deprecated/2.5.php

    r10606 r11256  
    6363    );
    6464
    65     remove_filter( 'bp_email_get_property', 'bp_core_deprecated_email_filters', 20, 4 );
     65    remove_filter( 'bp_email_get_property', 'bp_core_deprecated_email_filters', 20 );
    6666    $email_type = $email->get( 'type' );
    6767    $tokens     = $email->get( 'tokens' );
     
    702702    );
    703703
    704     remove_action( 'bp_send_email_success', 'bp_core_deprecated_email_actions', 20, 2 );
     704    remove_action( 'bp_send_email_success', 'bp_core_deprecated_email_actions', 20 );
    705705    $email_content = $email->get( 'content' );
    706706    $email_subject = $email->get( 'subject' );
  • trunk/src/bp-groups/bp-groups-template.php

    r11209 r11256  
    28382838    bp_get_options_nav( $group->slug . '_manage' );
    28392839
    2840     remove_filter( "bp_get_options_nav_{$css_id}", 'bp_group_admin_tabs_backcompat', 10, 3 );
     2840    remove_filter( "bp_get_options_nav_{$css_id}", 'bp_group_admin_tabs_backcompat', 10 );
    28412841}
    28422842
  • trunk/src/bp-groups/classes/class-bp-group-member-query.php

    r10454 r11256  
    331331
    332332        // Don't filter other BP_User_Query objects on the same page.
    333         remove_action( 'bp_user_query_populate_extras', array( $this, 'populate_group_member_extras' ), 10, 2 );
     333        remove_action( 'bp_user_query_populate_extras', array( $this, 'populate_group_member_extras' ), 10 );
    334334    }
    335335
  • trunk/src/bp-groups/classes/class-bp-groups-list-table.php

    r11176 r11256  
    723723            'show_all'       => true
    724724        ) );
    725         remove_filter( 'bp_get_group_type_directory_permalink', array( $this, 'group_type_permalink_use_admin_filter' ), 10, 2 );
     725        remove_filter( 'bp_get_group_type_directory_permalink', array( $this, 'group_type_permalink_use_admin_filter' ), 10 );
    726726
    727727        /**
  • trunk/src/bp-members/bp-members-functions.php

    r11110 r11256  
    11631163    // However, we mirror it there for backward compatibility. Do not use!
    11641164    // Remove our warning and re-add.
    1165     remove_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning', 10, 4 );
    1166     remove_filter( 'get_user_metadata', '_bp_get_user_meta_last_activity_warning', 10, 3 );
     1165    remove_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning', 10 );
     1166    remove_filter( 'get_user_metadata', '_bp_get_user_meta_last_activity_warning', 10 );
    11671167    bp_update_user_meta( $user_id, 'last_activity', $time );
    11681168    add_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning', 10, 4 );
  • trunk/src/bp-members/classes/class-bp-members-admin.php

    r11155 r11256  
    13071307     */
    13081308    public function remove_edit_profile_url_filter() {
    1309         remove_filter( 'bp_members_edit_profile_url', array( $this, 'filter_adminbar_profile_link' ), 10, 3 );
     1309        remove_filter( 'bp_members_edit_profile_url', array( $this, 'filter_adminbar_profile_link' ), 10 );
    13101310    }
    13111311
     
    22442244     */
    22452245    public function users_table_add_type_column( $columns = array() ) {
    2246         $columns[ bp_get_member_type_tax_name() ] = _x( 'Member Type', 'Label for the WP users table member type column' , 'buddypress' );
     2246        $columns[ bp_get_member_type_tax_name() ] = _x( 'Member Type', 'Label for the WP users table member type column', 'buddypress' );
    22472247
    22482248        return $columns;
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r11091 r11256  
    970970
    971971    if ( ! empty( $last_recorded ) ) {
    972         remove_filter( 'bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1 );
     972        remove_filter( 'bp_get_activity_css_class', 'bp_activity_newest_class', 10 );
    973973    }
    974974
  • trunk/tests/phpunit/includes/testcase.php

    r11254 r11256  
    224224            unset( $this->temp_has_bp_moderate[ $user_id ] );
    225225        }
    226         remove_filter( 'bp_current_user_can', array( $this, 'grant_bp_moderate_cb' ), 10, 2 );
     226        remove_filter( 'bp_current_user_can', array( $this, 'grant_bp_moderate_cb' ), 10 );
    227227    }
    228228
  • trunk/tests/phpunit/testcases/activity/actions.php

    r10550 r11256  
    8282
    8383        // Temporarily remove post type activity hook so activity item isn't created.
    84         remove_action( 'transition_post_status', 'bp_activity_catch_transition_post_type_status', 10, 3 );
     84        remove_action( 'transition_post_status', 'bp_activity_catch_transition_post_type_status', 10 );
    8585
    8686        // Create the initial post.
  • trunk/tests/phpunit/testcases/activity/notifications.php

    r10895 r11256  
    313313        );
    314314
    315         remove_filter( 'bp_activity_single_at_mentions_notification', array( $this, 'format_notification_filter' ), 10, 1 );
    316         remove_filter( 'bp_activity_multiple_at_mentions_notification', array( $this, 'format_notification_filter' ), 10, 1 );
     315        remove_filter( 'bp_activity_single_at_mentions_notification', array( $this, 'format_notification_filter' ), 10 );
     316        remove_filter( 'bp_activity_multiple_at_mentions_notification', array( $this, 'format_notification_filter' ), 10 );
    317317
    318318        $single = sprintf( __( '%1$s mentioned you', 'buddypress' ), bp_core_get_user_displayname( $this->u2 ) );
  • trunk/tests/phpunit/testcases/blogs/filters.php

    r10545 r11256  
    2929
    3030        _unregister_post_type( 'using_old_filter' );
    31         remove_filter( 'bp_blogs_record_post_post_types',    array( $this, 'filter_post_types'), 10, 1 );
    32         remove_filter( 'bp_blogs_record_comment_post_types', array( $this, 'filter_post_types'), 10, 1 );
     31        remove_filter( 'bp_blogs_record_post_post_types',    array( $this, 'filter_post_types' ), 10 );
     32        remove_filter( 'bp_blogs_record_comment_post_types', array( $this, 'filter_post_types' ), 10 );
    3333    }
    3434
  • trunk/tests/phpunit/testcases/core/avatars.php

    r10756 r11256  
    109109        $avatar = bp_core_fetch_avatar( $this->params );
    110110
    111         remove_filter( 'bp_core_fetch_avatar', array( $this, 'bp_core_fetch_avatar_filter_check' ), 12, 2 );
     111        remove_filter( 'bp_core_fetch_avatar', array( $this, 'bp_core_fetch_avatar_filter_check' ), 12 );
    112112
    113113        unset( $this->params );
  • trunk/tests/phpunit/testcases/core/caps.php

    r11052 r11256  
    1919        $can  = bp_current_user_can( 'foo', bp_get_root_blog_id() );
    2020        $cant = bp_current_user_can( 'foo', $b );
    21         remove_filter( 'user_has_cap', array( $this, 'grant_cap_foo' ), 10, 2 );
     21        remove_filter( 'user_has_cap', array( $this, 'grant_cap_foo' ), 10 );
    2222
    2323        $this->assertTrue( $can );
     
    4141        $can  = bp_current_user_can( 'foo', array( 'blog_id' => bp_get_root_blog_id() ) );
    4242        $cant = bp_current_user_can( 'foo', array( 'blog_id' => $b ) );
    43         remove_filter( 'user_has_cap', array( $this, 'grant_cap_foo' ), 10, 2 );
     43        remove_filter( 'user_has_cap', array( $this, 'grant_cap_foo' ), 10 );
    4444
    4545        $this->assertTrue( $can );
  • trunk/tests/phpunit/testcases/core/class-bp-attachment.php

    r11091 r11256  
    2323    public function tearDown() {
    2424        parent::tearDown();
    25         remove_filter( 'bp_attachment_upload_overrides',     array( $this, 'filter_overrides' ),       10, 1 );
    26         remove_filter( 'upload_dir',                         array( $this, 'filter_upload_dir' ),      20, 1 );
     25        remove_filter( 'bp_attachment_upload_overrides',     array( $this, 'filter_overrides' ),       10 );
     26        remove_filter( 'upload_dir',                         array( $this, 'filter_upload_dir' ),      20 );
    2727        add_filter( 'bp_attachments_cover_image_upload_dir', array( $this, 'filter_cover_image_dir' ), 10, 2 );
    2828        $this->upload_results = array();
     
    490490
    491491        // Remove the filter used to fake uploads
    492         remove_filter( 'upload_dir', array( $this, 'filter_upload_dir' ), 20, 1 );
     492        remove_filter( 'upload_dir', array( $this, 'filter_upload_dir' ), 20 );
    493493
    494494        $this->assertSame( $attachment_class->original_upload_dir, wp_upload_dir() );
  • trunk/tests/phpunit/testcases/core/functions/bpCoreGetDirectoryPageIds.php

    r11155 r11256  
    311311        $this->assertNotEmpty( $pages->activate );
    312312
    313         remove_action( 'update_option_users_can_register', array( $admin, 'single_site_registration_on' ), 10, 2 );
     313        remove_action( 'update_option_users_can_register', array( $admin, 'single_site_registration_on' ), 10 );
    314314    }
    315315
     
    338338        $this->assertNotEmpty( $pages->activate );
    339339
    340         remove_action( 'update_site_option_registration', array( $admin, 'multisite_registration_on' ), 10, 2 );
     340        remove_action( 'update_site_option_registration', array( $admin, 'multisite_registration_on' ), 10 );
    341341    }
    342342}
  • trunk/tests/phpunit/testcases/core/functions/bpVerifyNonceRequest.php

    r10047 r11256  
    5959
    6060        // clean up!
    61         remove_filter( 'home_url', array( $this, 'add_port_and_subdirectory_to_home_url' ), 10, 3 );
     61        remove_filter( 'home_url', array( $this, 'add_port_and_subdirectory_to_home_url' ), 10 );
    6262        unset( $_REQUEST[$action] );
    6363
  • trunk/tests/phpunit/testcases/core/nav/bpCoreRemoveNavItem.php

    r11147 r11256  
    9393        ), 'foo' );
    9494
    95         remove_filter( 'bp_is_active', array( $this, 'foo_is_active' ), 10, 2 );
     95        remove_filter( 'bp_is_active', array( $this, 'foo_is_active' ), 10 );
    9696
    9797        $this->assertNotEmpty( $bp->foo->nav->get_primary( array( 'slug' => 'foo' ), false ) );
  • trunk/tests/phpunit/testcases/core/suggestions.php

    r9819 r11256  
    5252
    5353        // Create some dummy friendships (but not the corresponding activity items).
    54         remove_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 4 );
     54        remove_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10 );
    5555        friends_add_friend( self::$current_user, self::$user_ids['aardvark'], true );
    5656        friends_add_friend( self::$current_user, self::$user_ids['cat'], true );
Note: See TracChangeset for help on using the changeset viewer.