Ticket #8571: 8571.patch
File 8571.patch, 17.3 KB (added by , 3 years ago) |
---|
-
.github/workflows/unit-tests.yml
diff --git .github/workflows/unit-tests.yml .github/workflows/unit-tests.yml index 420dea24b..bb3cd9d41 100644
jobs: 18 18 wp_version: '5.8' 19 19 - php: '7.4' 20 20 wp_version: '5.8' 21 - php: '7.4' 22 wp_version: '5.4' 21 23 env: 22 24 WP_ENV_PHP_VERSION: ${{ matrix.php }} 23 25 WP_VERSION: ${{ matrix.wp_version }} -
src/bp-blogs/bp-blogs-functions.php
diff --git src/bp-blogs/bp-blogs-functions.php src/bp-blogs/bp-blogs-functions.php index c64e88ab7..09cc5f1f1 100644
add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2 574 574 * Deletes the 'url' blogmeta for a site. 575 575 * 576 576 * Fires when a site's details are updated, which generally happens when 577 * editing a site under "Network Admin > Sites". Prior to WP 4.9, the 578 * correct hook was 'refresh_blog_details'; afterward, 'clean_site_cache'. 577 * editing a site under "Network Admin > Sites". 579 578 * 580 579 * @since 2.3.0 581 580 * … … add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2 584 583 function bp_blogs_delete_url_blogmeta( $site_id = 0 ) { 585 584 bp_blogs_delete_blogmeta( (int) $site_id, 'url' ); 586 585 } 587 588 if ( bp_is_running_wp( '4.9.0' ) ) { 589 add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' ); 590 } else { 591 add_action( 'refresh_blog_details', 'bp_blogs_delete_url_blogmeta' ); 592 } 586 add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' ); 593 587 594 588 /** 595 589 * Record activity metadata about a published blog post. -
src/bp-core/admin/js/hello.js
diff --git src/bp-core/admin/js/hello.js src/bp-core/admin/js/hello.js index 8324e6cc2..47c996579 100644
4 4 * 5 5 * @since 3.0.0 6 6 */ 7 (function( $, bp ) {7 (function( $, wp ) { 8 8 // Bail if not set 9 9 if ( typeof bpHelloStrings === 'undefined' ) { 10 10 return; … … 79 79 80 80 $( '#TB_window' ).addClass( 'thickbox-loading' ); 81 81 82 bp.apiRequest( {82 wp.apiRequest( { 83 83 url: anchor.data( 'endpoint' ), 84 84 type: 'GET', 85 85 beforeSend: function( xhr, settings ) { … … 118 118 } ); 119 119 120 120 // Init modal after the screen's loaded. 121 $( document ).ready(function() {121 $( function() { 122 122 bpHelloOpenModal(); 123 123 } ); 124 124 125 }( jQuery, window. bp || {} ) );125 }( jQuery, window.wp || {} ) ); -
src/bp-core/bp-core-functions.php
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php index 3dbc32f11..8b2653276 100644
function bp_register_type_meta( $type_tax, $meta_key, array $args ) { 3270 3270 return false; 3271 3271 } 3272 3272 3273 // register_term_meta() was introduced in WP 4.9.8.3274 if ( ! bp_is_running_wp( '4.9.8' ) ) {3275 $args['object_subtype'] = $type_tax;3276 3277 return register_meta( 'term', $meta_key, $args );3278 }3279 3280 3273 return register_term_meta( $type_tax, $meta_key, $args ); 3281 3274 } 3282 3275 … … function bp_email_get_appearance_settings() { 3684 3677 ) 3685 3678 ); 3686 3679 3687 if ( bp_is_running_wp( '4.9.6' ) ) { 3688 $privacy_policy_url = get_privacy_policy_url(); 3689 if ( $privacy_policy_url ) { 3690 $footer_text[] = sprintf( 3691 '<a href="%s">%s</a>', 3692 esc_url( $privacy_policy_url ), 3693 esc_html__( 'Privacy Policy', 'buddypress' ) 3694 ); 3695 } 3680 $privacy_policy_url = get_privacy_policy_url(); 3681 if ( $privacy_policy_url ) { 3682 $footer_text[] = sprintf( 3683 '<a href="%s">%s</a>', 3684 esc_url( $privacy_policy_url ), 3685 esc_html__( 'Privacy Policy', 'buddypress' ) 3686 ); 3696 3687 } 3697 3688 3698 3689 $default_args = array( -
src/bp-core/bp-core-rest-api.php
diff --git src/bp-core/bp-core-rest-api.php src/bp-core/bp-core-rest-api.php index a0a719b56..74c8e1061 100644
function bp_rest_api_is_available() { 63 63 * Register the jQuery.ajax wrapper for BP REST API requests. 64 64 * 65 65 * @since 5.0.0 66 * @deprecated 10.0.0 66 67 */ 67 68 function bp_rest_api_register_request_script() { 68 69 if ( ! bp_rest_api_is_available() ) { 69 70 return; 70 71 } 71 72 72 $dependencies = array( 'jquery' );73 74 // The wrapper for WP REST API requests was introduced in WordPress 4.9.0.75 if ( wp_script_is( 'wp-api-request', 'registered' ) ) {76 $dependencies = array( 'wp-api-request' );77 }78 79 73 wp_register_script( 80 74 'bp-api-request', 81 75 sprintf( '%1$sbp-core/js/bp-api-request%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ), 82 $dependencies,76 array( 'jquery', 'wp-api-request' ), 83 77 bp_get_version(), 84 78 true 85 79 ); … … function bp_rest_api_register_request_script() { 88 82 'bp-api-request', 89 83 'bpApiSettings', 90 84 array( 91 'root' => esc_url_raw( get_rest_url() ), 92 'nonce' => wp_create_nonce( 'wp_rest' ), 93 'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ), 85 'root' => esc_url_raw( get_rest_url() ), 86 'nonce' => wp_create_nonce( 'wp_rest' ), 87 'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ), 88 'deprecatedWarning' => __( 'The bp.apiRequest function is deprecated since BuddyPress 10.0.0, please use wp.apiRequest instead.', 'buddypress' ), 94 89 ) 95 90 ); 96 91 } -
src/bp-core/bp-core-wpabstraction.php
diff --git src/bp-core/bp-core-wpabstraction.php src/bp-core/bp-core-wpabstraction.php index ebeb1fbc3..8f7e524bf 100644
if ( !function_exists( 'mb_strrpos' ) ) { 308 308 } 309 309 } 310 310 311 /**312 * Returns the name of the hook to use once a WordPress Site is inserted into the Database.313 *314 * WordPress 5.1.0 deprecated the `wpmu_new_blog` action. As BuddyPress is supporting WordPress back315 * to 4.9.0, this function makes sure we are using the new hook `wp_initialize_site` when the current316 * WordPress version is upper or equal to 5.1.0 and that we keep on using `wpmu_new_blog` for earlier317 * versions of WordPress.318 *319 * @since 6.0.0320 *321 * @return string The name of the hook to use.322 */323 function bp_insert_site_hook() {324 $wp_hook = 'wpmu_new_blog';325 326 if ( function_exists( 'wp_insert_site' ) ) {327 $wp_hook = 'wp_initialize_site';328 }329 330 return $wp_hook;331 }332 333 311 /** 334 312 * Catch the new site data for a later use. 335 313 * … … function bp_insert_site( $site, $args_or_user_id = null, $domain = '', $path = ' 399 377 */ 400 378 do_action( 'bp_insert_site', $site_id, $user_id, $domain, $path, $network_id, $meta ); 401 379 } 402 add_action( bp_insert_site_hook(), 'bp_insert_site' ); 403 404 /** 405 * Returns the name of the hook to use once a WordPress Site is deleted. 406 * 407 * WordPress 5.1.0 deprecated the `delete_blog` action. As BuddyPress is supporting WordPress back 408 * to 4.9.0, this function makes sure we are using the new hook `wp_validate_site_deletion` when the 409 * current WordPress version is upper or equal to 5.1.0 and that we keep on using `delete_blog` for 410 * earlier versions of WordPress. 411 * 412 * @since 6.0.0 413 * 414 * @return string The name of the hook to use. 415 */ 416 function bp_delete_site_hook() { 417 $wp_hook = 'delete_blog'; 418 419 if ( function_exists( 'wp_delete_site' ) ) { 420 $wp_hook = 'wp_validate_site_deletion'; 421 } 422 423 return $wp_hook; 424 } 380 add_action( 'wp_initialize_site', 'bp_insert_site' ); 425 381 426 382 /** 427 383 * Makes sure the `bp_delete_site` hook is fired if site's deletion … … function bp_delete_site( $site_id_or_error, $drop_or_site = false ) { 471 427 */ 472 428 do_action( 'bp_delete_site', $site_id, $drop ); 473 429 } 474 add_action( bp_delete_site_hook(), 'bp_delete_site', 10, 2 ); 475 476 if ( ! function_exists( 'wp_parse_list' ) ) { 477 /** 478 * Cleans up an array, comma- or space-separated list of scalar values. 479 * 480 * As BuddyPress supports older WordPress versions than 5.1 (4.9 & 5.0), 481 * the BP REST API needs this function to be available. 482 * 483 * @since 7.0.0 484 * 485 * @param array|string $list List of values. 486 * @return array Sanitized array of values. 487 */ 488 function wp_parse_list( $list ) { 489 if ( ! is_array( $list ) ) { 490 return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY ); 491 } 492 493 return $list; 494 } 495 } 430 add_action( 'wp_validate_site_deletion', 'bp_delete_site', 10, 2 ); -
src/bp-core/classes/class-bp-admin.php
diff --git src/bp-core/classes/class-bp-admin.php src/bp-core/classes/class-bp-admin.php index ee80328cc..97b9ea449 100644
class BP_Admin { 573 573 * @since 4.0.0 574 574 */ 575 575 public function add_privacy_policy_content() { 576 // Nothing to do if we're running < WP 4.9.6.577 if ( bp_is_running_wp( '4.9.6', '<' ) ) {578 return;579 }580 581 576 $suggested_text = '<strong class="privacy-policy-tutorial">' . esc_html__( 'Suggested text:', 'buddypress' ) . ' </strong>'; 582 577 $content = ''; 583 578 … … class BP_Admin { 1213 1208 // 3.0 1214 1209 'bp-hello-js' => array( 1215 1210 'file' => "{$url}hello{$min}.js", 1216 'dependencies' => array( 'thickbox', ' bp-api-request' ),1211 'dependencies' => array( 'thickbox', 'wp-api-request' ), 1217 1212 'footer' => true, 1218 1213 ), 1219 1214 ) ); -
src/bp-core/deprecated/10.0.php
diff --git src/bp-core/deprecated/10.0.php src/bp-core/deprecated/10.0.php index e69de29bb..7ff78b259 100644
1 <?php 2 /** 3 * Deprecated functions. 4 * 5 * @package BuddyPress 6 * @deprecated 10.0.0 7 */ 8 9 // Exit if accessed directly. 10 if ( ! defined( 'ABSPATH' ) ) { 11 exit; 12 } 13 14 /** 15 * Returns the name of the hook to use once a WordPress Site is inserted into the Database. 16 * 17 * WordPress 5.1.0 deprecated the `wpmu_new_blog` action. As BuddyPress is supporting WordPress back 18 * to 4.9.0, this function makes sure we are using the new hook `wp_initialize_site` when the current 19 * WordPress version is upper or equal to 5.1.0 and that we keep on using `wpmu_new_blog` for earlier 20 * versions of WordPress. 21 * 22 * @since 6.0.0 23 * @deprecated 10.0.0 24 * 25 * @return string The name of the hook to use. 26 */ 27 function bp_insert_site_hook() { 28 _deprecated_function( __FUNCTION__, '10.0.0' ); 29 30 $wp_hook = 'wpmu_new_blog'; 31 32 if ( function_exists( 'wp_insert_site' ) ) { 33 $wp_hook = 'wp_initialize_site'; 34 } 35 36 return $wp_hook; 37 } 38 39 /** 40 * Returns the name of the hook to use once a WordPress Site is deleted. 41 * 42 * WordPress 5.1.0 deprecated the `delete_blog` action. As BuddyPress is supporting WordPress back 43 * to 4.9.0, this function makes sure we are using the new hook `wp_validate_site_deletion` when the 44 * current WordPress version is upper or equal to 5.1.0 and that we keep on using `delete_blog` for 45 * earlier versions of WordPress. 46 * 47 * @since 6.0.0 48 * @deprecated 10.0.0 49 * 50 * @return string The name of the hook to use. 51 */ 52 function bp_delete_site_hook() { 53 _deprecated_function( __FUNCTION__, '10.0.0' ); 54 55 $wp_hook = 'delete_blog'; 56 57 if ( function_exists( 'wp_delete_site' ) ) { 58 $wp_hook = 'wp_validate_site_deletion'; 59 } 60 61 return $wp_hook; 62 } -
src/bp-core/js/bp-api-request.js
diff --git src/bp-core/js/bp-api-request.js src/bp-core/js/bp-api-request.js index 339b1c1a9..cb450f8ed 100644
2 2 * jQuery.ajax wrapper for BP REST API requests. 3 3 * 4 4 * @since 5.0.0 5 * @deprecated 10.0.0 5 6 * @output bp-core/js/bp-api-request.js 6 7 */ 7 8 /* global bpApiSettings */ 8 9 window.bp = window.bp || {}; 9 10 10 ( function( wp, bp , $) {11 ( function( wp, bp ) { 11 12 // Bail if not set. 12 13 if ( typeof bpApiSettings === 'undefined' ) { 13 14 return; … … window.bp = window.bp || {}; 15 16 16 17 bp.isRestEnabled = true; 17 18 18 // Polyfill wp.apiRequest if WordPress < 4.9.19 // Polyfill wp.apiRequest. 19 20 bp.apiRequest = function( options ) { 21 window.console.log( bpApiSettings.deprecatedWarning ); 22 20 23 var bpRequest; 21 24 22 25 if ( ! options.dataType ) { 23 26 options.dataType = 'json'; 24 27 } 25 28 26 // WordPress is >= 4.9.0. 27 if ( wp.apiRequest ) { 28 bpRequest = wp.apiRequest( options ); 29 30 // WordPress is < 4.9.0. 31 } else { 32 var url = bpApiSettings.root; 33 34 if ( options.path ) { 35 url = url + options.path.replace( /^\//, '' ); 36 } 37 38 if ( ! options.url ) { 39 options.url = url; 40 } 41 42 // Add The nonce only when needed. 43 if ( -1 !== options.url.indexOf( url ) ) { 44 options.beforeSend = function( xhr ) { 45 xhr.setRequestHeader( 'X-WP-Nonce', bpApiSettings.nonce ); 46 }; 47 } 48 49 bpRequest = $.ajax( options ); 50 } 29 bpRequest = wp.apiRequest( options ); 51 30 52 31 return bpRequest.then( null, function( result ) { 53 32 var errorObject = { … … window.bp = window.bp || {}; 66 45 } ); 67 46 }; 68 47 69 } )( window.wp || {}, window.bp , jQuery);48 } )( window.wp || {}, window.bp ); -
src/bp-groups/bp-groups-cssjs.php
diff --git src/bp-groups/bp-groups-cssjs.php src/bp-groups/bp-groups-cssjs.php index 99aab5bb6..915d1611c 100644
function bp_groups_register_scripts() { 19 19 wp_register_script( 20 20 'bp-group-manage-members', 21 21 sprintf( '%1$sbp-groups/js/manage-members%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ), 22 array( 'json2', 'wp-backbone', ' bp-api-request' ),22 array( 'json2', 'wp-backbone', 'wp-api-request' ), 23 23 bp_get_version(), 24 24 true 25 25 ); -
src/bp-groups/js/manage-members.js
diff --git src/bp-groups/js/manage-members.js src/bp-groups/js/manage-members.js index 34ef7dccb..69358a431 100644
4 4 ( function( wp, bp, $ ) { 5 5 6 6 // Bail if not set 7 if ( typeof bpGroupManageMembersSettings === 'undefined' || ! bp.isRestEnabled) {7 if ( typeof bpGroupManageMembersSettings === 'undefined' ) { 8 8 return; 9 9 } 10 10 … … 62 62 options.headers = { 'X-HTTP-Method-Override': 'PUT' }; 63 63 } 64 64 65 return bp.apiRequest( options );65 return wp.apiRequest( options ); 66 66 } 67 67 }, 68 68 … … 117 117 } 118 118 }; 119 119 120 return bp.apiRequest( options );120 return wp.apiRequest( options ); 121 121 } 122 122 } 123 123 } ); -
src/bp-members/bp-members-template.php
diff --git src/bp-members/bp-members-template.php src/bp-members/bp-members-template.php index 39cfd6e65..10e6ef071 100644
function bp_signup_avatar_dir_value() { 2745 2745 * @return bool 2746 2746 */ 2747 2747 function bp_signup_requires_privacy_policy_acceptance() { 2748 // Bail if we're running a version of WP that doesn't have the Privacy Policy feature.2749 if ( bp_is_running_wp( '4.9.6', '<' ) ) {2750 return false;2751 }2752 2748 2753 2749 // Default to true when a published Privacy Policy page exists. 2754 2750 $privacy_policy_url = get_privacy_policy_url(); -
src/bp-settings/bp-settings-functions.php
diff --git src/bp-settings/bp-settings-functions.php src/bp-settings/bp-settings-functions.php index 12acd24f9..399966914 100644
function bp_settings_get_personal_data_request( $user_id = 0 ) { 248 248 ) ); 249 249 250 250 if ( ! empty( $query->post ) ) { 251 // WP 5.4 changed the user request function name to wp_get_user_request() 252 $user_request = bp_is_running_wp( '4.9.6' ) ? 'wp_get_user_request' : 'wp_get_user_request_data'; 253 return $user_request( $query->post->ID ); 251 return wp_get_user_request( $query->post->ID ); 254 252 } else { 255 253 return false; 256 254 } -
src/bp-settings/classes/class-bp-settings-component.php
diff --git src/bp-settings/classes/class-bp-settings-component.php src/bp-settings/classes/class-bp-settings-component.php index c39bff37e..eb7f0acb0 100644
class BP_Settings_Component extends BP_Component { 198 198 */ 199 199 $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true ); 200 200 201 // Export Data - only available for WP 4.9.6+.202 if ( true === $show_data_page && bp_is_running_wp( '4.9.6' )) {201 // Export Data. 202 if ( true === $show_data_page ) { 203 203 $sub_nav[] = array( 204 204 'name' => __( 'Export Data', 'buddypress' ), 205 205 'slug' => 'data', … … class BP_Settings_Component extends BP_Component { 278 278 $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true ); 279 279 280 280 // Export Data. 281 if ( true === $show_data_page && bp_is_running_wp( '4.9.6' )) {281 if ( true === $show_data_page ) { 282 282 $wp_admin_nav[] = array( 283 283 'parent' => 'my-account-' . $this->id, 284 284 'id' => 'my-account-' . $this->id . '-data', -
src/class-buddypress.php
diff --git src/class-buddypress.php src/class-buddypress.php index e8f2a9797..981ae06a1 100644
class BuddyPress { 558 558 require $this->plugin_dir . 'bp-core/deprecated/7.0.php'; 559 559 require $this->plugin_dir . 'bp-core/deprecated/8.0.php'; 560 560 require $this->plugin_dir . 'bp-core/deprecated/9.0.php'; 561 require $this->plugin_dir . 'bp-core/deprecated/10.0.php'; 561 562 } 562 563 563 564 // Load wp-cli module if PHP 5.6+. -
src/readme.txt
diff --git src/readme.txt src/readme.txt index 5e7eb3bfc..1a5e9b358 100644
Contributors: johnjamesjacoby, DJPaul, boonebgorges, r-a-y, imath, mercime, tw21 3 3 Tags: user profiles, activity streams, messaging, friends, user groups, notifications, community, social networking, intranet 4 4 License: GPLv2 or later 5 5 License URI: https://www.gnu.org/licenses/gpl-2.0.html 6 Requires at least: 4.96 Requires at least: 5.4 7 7 Requires PHP: 5.6 8 8 Tested up to: 5.8 9 9 Stable tag: 9.1.1