diff --git .github/workflows/unit-tests.yml .github/workflows/unit-tests.yml
index 420dea24b..bb3cd9d41 100644
--- .github/workflows/unit-tests.yml
+++ .github/workflows/unit-tests.yml
@@ -18,6 +18,8 @@ jobs:
wp_version: '5.8'
- php: '7.4'
wp_version: '5.8'
+ - php: '7.4'
+ wp_version: '5.4'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wp_version }}
diff --git src/bp-blogs/bp-blogs-functions.php src/bp-blogs/bp-blogs-functions.php
index c64e88ab7..09cc5f1f1 100644
--- src/bp-blogs/bp-blogs-functions.php
+++ src/bp-blogs/bp-blogs-functions.php
@@ -574,8 +574,7 @@ add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2
* Deletes the 'url' blogmeta for a site.
*
* Fires when a site's details are updated, which generally happens when
- * editing a site under "Network Admin > Sites". Prior to WP 4.9, the
- * correct hook was 'refresh_blog_details'; afterward, 'clean_site_cache'.
+ * editing a site under "Network Admin > Sites".
*
* @since 2.3.0
*
@@ -584,12 +583,7 @@ add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2
function bp_blogs_delete_url_blogmeta( $site_id = 0 ) {
bp_blogs_delete_blogmeta( (int) $site_id, 'url' );
}
-
-if ( bp_is_running_wp( '4.9.0' ) ) {
- add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' );
-} else {
- add_action( 'refresh_blog_details', 'bp_blogs_delete_url_blogmeta' );
-}
+add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' );
/**
* Record activity metadata about a published blog post.
diff --git src/bp-core/admin/js/hello.js src/bp-core/admin/js/hello.js
index 8324e6cc2..47c996579 100644
--- src/bp-core/admin/js/hello.js
+++ src/bp-core/admin/js/hello.js
@@ -4,7 +4,7 @@
*
* @since 3.0.0
*/
-(function( $, bp ) {
+(function( $, wp ) {
// Bail if not set
if ( typeof bpHelloStrings === 'undefined' ) {
return;
@@ -79,7 +79,7 @@
$( '#TB_window' ).addClass( 'thickbox-loading' );
- bp.apiRequest( {
+ wp.apiRequest( {
url: anchor.data( 'endpoint' ),
type: 'GET',
beforeSend: function( xhr, settings ) {
@@ -118,8 +118,8 @@
} );
// Init modal after the screen's loaded.
- $( document ).ready( function() {
+ $( function() {
bpHelloOpenModal();
} );
-}( jQuery, window.bp || {} ) );
+}( jQuery, window.wp || {} ) );
diff --git src/bp-core/bp-core-blocks.php src/bp-core/bp-core-blocks.php
index cc5d93c12..1ce5c1f18 100644
--- src/bp-core/bp-core-blocks.php
+++ src/bp-core/bp-core-blocks.php
@@ -11,7 +11,7 @@
defined( 'ABSPATH' ) || exit;
/**
- * BuddyPress blocks require WordPress >= 5.0.0 & the BP REST API.
+ * BuddyPress blocks require the BP REST API.
*
* @since 6.0.0
*
@@ -19,7 +19,14 @@ defined( 'ABSPATH' ) || exit;
* False otherwise.
*/
function bp_support_blocks() {
- return bp_is_running_wp( '5.0.0' ) && bp_rest_api_is_available();
+ /**
+ * Filter here, returning `false`, to completely disable BuddyPress blocks.
+ *
+ * @since 10.0.0
+ *
+ * @param bool $value True if the BP REST API is available. False otherwise.
+ */
+ return apply_filters( 'bp_support_blocks', bp_rest_api_is_available() );
}
/**
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
index 3dbc32f11..8b2653276 100644
--- src/bp-core/bp-core-functions.php
+++ src/bp-core/bp-core-functions.php
@@ -3270,13 +3270,6 @@ function bp_register_type_meta( $type_tax, $meta_key, array $args ) {
return false;
}
- // register_term_meta() was introduced in WP 4.9.8.
- if ( ! bp_is_running_wp( '4.9.8' ) ) {
- $args['object_subtype'] = $type_tax;
-
- return register_meta( 'term', $meta_key, $args );
- }
-
return register_term_meta( $type_tax, $meta_key, $args );
}
@@ -3684,15 +3677,13 @@ function bp_email_get_appearance_settings() {
)
);
- if ( bp_is_running_wp( '4.9.6' ) ) {
- $privacy_policy_url = get_privacy_policy_url();
- if ( $privacy_policy_url ) {
- $footer_text[] = sprintf(
- '%s',
- esc_url( $privacy_policy_url ),
- esc_html__( 'Privacy Policy', 'buddypress' )
- );
- }
+ $privacy_policy_url = get_privacy_policy_url();
+ if ( $privacy_policy_url ) {
+ $footer_text[] = sprintf(
+ '%s',
+ esc_url( $privacy_policy_url ),
+ esc_html__( 'Privacy Policy', 'buddypress' )
+ );
}
$default_args = array(
diff --git src/bp-core/bp-core-rest-api.php src/bp-core/bp-core-rest-api.php
index a0a719b56..0f61d0463 100644
--- src/bp-core/bp-core-rest-api.php
+++ src/bp-core/bp-core-rest-api.php
@@ -50,36 +50,30 @@ function bp_rest_api_is_available() {
/**
* Filter here to disable the BP REST API.
*
- * The BP REST API requires at least WordPress 4.7.0
+ * The BP REST API requires at least WordPress 4.7.0.
*
* @since 5.0.0
*
* @param boolean $value True if the BP REST API is available. False otherwise.
*/
- return apply_filters( 'bp_rest_api_is_available', bp_is_running_wp( '4.7.0' ) && bp_rest_in_buddypress() ) || bp_rest_is_plugin_active();
+ return apply_filters( 'bp_rest_api_is_available', bp_rest_in_buddypress() ) || bp_rest_is_plugin_active();
}
/**
* Register the jQuery.ajax wrapper for BP REST API requests.
*
* @since 5.0.0
+ * @deprecated 10.0.0
*/
function bp_rest_api_register_request_script() {
if ( ! bp_rest_api_is_available() ) {
return;
}
- $dependencies = array( 'jquery' );
-
- // The wrapper for WP REST API requests was introduced in WordPress 4.9.0.
- if ( wp_script_is( 'wp-api-request', 'registered' ) ) {
- $dependencies = array( 'wp-api-request' );
- }
-
wp_register_script(
'bp-api-request',
sprintf( '%1$sbp-core/js/bp-api-request%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
- $dependencies,
+ array( 'jquery', 'wp-api-request' ),
bp_get_version(),
true
);
@@ -88,9 +82,8 @@ function bp_rest_api_register_request_script() {
'bp-api-request',
'bpApiSettings',
array(
- 'root' => esc_url_raw( get_rest_url() ),
- 'nonce' => wp_create_nonce( 'wp_rest' ),
- 'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ),
+ 'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ),
+ 'deprecatedWarning' => __( 'The bp.apiRequest function is deprecated since BuddyPress 10.0.0, please use wp.apiRequest instead.', 'buddypress' ),
)
);
}
diff --git src/bp-core/bp-core-template.php src/bp-core/bp-core-template.php
index efb251957..a88cd6800 100644
--- src/bp-core/bp-core-template.php
+++ src/bp-core/bp-core-template.php
@@ -3884,7 +3884,7 @@ function bp_is_widget_block_active( $block_name = '', $widget_id_base = '' ) {
'block' => false,
);
- if ( $block_name && bp_is_running_wp( '5.0.0', '>=' ) ) {
+ if ( $block_name && bp_is_running_wp( '5.8.0', '>=' ) ) {
$widget_blocks = get_option( 'widget_block', array() );
$sidebars = wp_get_sidebars_widgets();
diff --git src/bp-core/bp-core-wpabstraction.php src/bp-core/bp-core-wpabstraction.php
index ebeb1fbc3..8f7e524bf 100644
--- src/bp-core/bp-core-wpabstraction.php
+++ src/bp-core/bp-core-wpabstraction.php
@@ -308,28 +308,6 @@ if ( !function_exists( 'mb_strrpos' ) ) {
}
}
-/**
- * Returns the name of the hook to use once a WordPress Site is inserted into the Database.
- *
- * WordPress 5.1.0 deprecated the `wpmu_new_blog` action. As BuddyPress is supporting WordPress back
- * to 4.9.0, this function makes sure we are using the new hook `wp_initialize_site` when the current
- * WordPress version is upper or equal to 5.1.0 and that we keep on using `wpmu_new_blog` for earlier
- * versions of WordPress.
- *
- * @since 6.0.0
- *
- * @return string The name of the hook to use.
- */
-function bp_insert_site_hook() {
- $wp_hook = 'wpmu_new_blog';
-
- if ( function_exists( 'wp_insert_site' ) ) {
- $wp_hook = 'wp_initialize_site';
- }
-
- return $wp_hook;
-}
-
/**
* Catch the new site data for a later use.
*
@@ -399,29 +377,7 @@ function bp_insert_site( $site, $args_or_user_id = null, $domain = '', $path = '
*/
do_action( 'bp_insert_site', $site_id, $user_id, $domain, $path, $network_id, $meta );
}
-add_action( bp_insert_site_hook(), 'bp_insert_site' );
-
-/**
- * Returns the name of the hook to use once a WordPress Site is deleted.
- *
- * WordPress 5.1.0 deprecated the `delete_blog` action. As BuddyPress is supporting WordPress back
- * to 4.9.0, this function makes sure we are using the new hook `wp_validate_site_deletion` when the
- * current WordPress version is upper or equal to 5.1.0 and that we keep on using `delete_blog` for
- * earlier versions of WordPress.
- *
- * @since 6.0.0
- *
- * @return string The name of the hook to use.
- */
-function bp_delete_site_hook() {
- $wp_hook = 'delete_blog';
-
- if ( function_exists( 'wp_delete_site' ) ) {
- $wp_hook = 'wp_validate_site_deletion';
- }
-
- return $wp_hook;
-}
+add_action( 'wp_initialize_site', 'bp_insert_site' );
/**
* Makes sure the `bp_delete_site` hook is fired if site's deletion
@@ -471,25 +427,4 @@ function bp_delete_site( $site_id_or_error, $drop_or_site = false ) {
*/
do_action( 'bp_delete_site', $site_id, $drop );
}
-add_action( bp_delete_site_hook(), 'bp_delete_site', 10, 2 );
-
-if ( ! function_exists( 'wp_parse_list' ) ) {
- /**
- * Cleans up an array, comma- or space-separated list of scalar values.
- *
- * As BuddyPress supports older WordPress versions than 5.1 (4.9 & 5.0),
- * the BP REST API needs this function to be available.
- *
- * @since 7.0.0
- *
- * @param array|string $list List of values.
- * @return array Sanitized array of values.
- */
- function wp_parse_list( $list ) {
- if ( ! is_array( $list ) ) {
- return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
- }
-
- return $list;
- }
-}
+add_action( 'wp_validate_site_deletion', 'bp_delete_site', 10, 2 );
diff --git src/bp-core/classes/class-bp-admin.php src/bp-core/classes/class-bp-admin.php
index ee80328cc..97b9ea449 100644
--- src/bp-core/classes/class-bp-admin.php
+++ src/bp-core/classes/class-bp-admin.php
@@ -573,11 +573,6 @@ class BP_Admin {
* @since 4.0.0
*/
public function add_privacy_policy_content() {
- // Nothing to do if we're running < WP 4.9.6.
- if ( bp_is_running_wp( '4.9.6', '<' ) ) {
- return;
- }
-
$suggested_text = '' . esc_html__( 'Suggested text:', 'buddypress' ) . ' ';
$content = '';
@@ -1213,7 +1208,7 @@ class BP_Admin {
// 3.0
'bp-hello-js' => array(
'file' => "{$url}hello{$min}.js",
- 'dependencies' => array( 'thickbox', 'bp-api-request' ),
+ 'dependencies' => array( 'thickbox', 'wp-api-request' ),
'footer' => true,
),
) );
diff --git src/bp-core/deprecated/10.0.php src/bp-core/deprecated/10.0.php
new file mode 100644
index 000000000..7ff78b259
--- /dev/null
+++ src/bp-core/deprecated/10.0.php
@@ -0,0 +1,62 @@
+= 4.9.0.
- if ( wp.apiRequest ) {
- bpRequest = wp.apiRequest( options );
-
- // WordPress is < 4.9.0.
- } else {
- var url = bpApiSettings.root;
-
- if ( options.path ) {
- url = url + options.path.replace( /^\//, '' );
- }
-
- if ( ! options.url ) {
- options.url = url;
- }
-
- // Add The nonce only when needed.
- if ( -1 !== options.url.indexOf( url ) ) {
- options.beforeSend = function( xhr ) {
- xhr.setRequestHeader( 'X-WP-Nonce', bpApiSettings.nonce );
- };
- }
-
- bpRequest = $.ajax( options );
- }
+ bpRequest = wp.apiRequest( options );
return bpRequest.then( null, function( result ) {
var errorObject = {
@@ -66,4 +45,4 @@ window.bp = window.bp || {};
} );
};
-} )( window.wp || {}, window.bp, jQuery );
+} )( window.wp || {}, window.bp );
diff --git src/bp-friends/bp-friends-blocks.php src/bp-friends/bp-friends-blocks.php
index cd0d23abc..3a2eaafc5 100644
--- src/bp-friends/bp-friends-blocks.php
+++ src/bp-friends/bp-friends-blocks.php
@@ -207,10 +207,7 @@ function bp_friends_render_friends_block( $attributes = array() ) {
$path
);
- $preloaded_friends = array();
- if ( bp_is_running_wp( '5.0.0' ) ) {
- $preloaded_friends = rest_preload_api_request( '', $default_path );
- }
+ $preloaded_friends = rest_preload_api_request( '', $default_path );
buddypress()->friends->block_globals['bp/friends']->items[ $widget_id ] = (object) array(
'selector' => $widget_id,
diff --git src/bp-groups/bp-groups-blocks.php src/bp-groups/bp-groups-blocks.php
index 42bda3cd7..f0e032dfc 100644
--- src/bp-groups/bp-groups-blocks.php
+++ src/bp-groups/bp-groups-blocks.php
@@ -483,10 +483,7 @@ function bp_groups_render_dynamic_groups_block( $attributes = array() ) {
$path
);
- $preloaded_groups = array();
- if ( bp_is_running_wp( '5.0.0' ) ) {
- $preloaded_groups = rest_preload_api_request( '', $default_path );
- }
+ $preloaded_groups = rest_preload_api_request( '', $default_path );
buddypress()->groups->block_globals['bp/dynamic-groups']->items[ $widget_id ] = (object) array(
'selector' => $widget_id,
diff --git src/bp-groups/bp-groups-cssjs.php src/bp-groups/bp-groups-cssjs.php
index 99aab5bb6..3f5ec3804 100644
--- src/bp-groups/bp-groups-cssjs.php
+++ src/bp-groups/bp-groups-cssjs.php
@@ -19,7 +19,7 @@ function bp_groups_register_scripts() {
wp_register_script(
'bp-group-manage-members',
sprintf( '%1$sbp-groups/js/manage-members%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
- array( 'json2', 'wp-backbone', 'bp-api-request' ),
+ array( 'json2', 'wp-backbone', 'wp-api-request' ),
bp_get_version(),
true
);
@@ -49,10 +49,7 @@ function bp_groups_get_group_manage_members_script_data( $group_id = 0 ) {
$group_id
);
- $preloaded_members = array();
- if ( bp_is_running_wp( '5.0.0' ) ) {
- $preloaded_members = rest_preload_api_request( '', $path );
- }
+ $preloaded_members = rest_preload_api_request( '', $path );
return array(
'path' => remove_query_arg( 'exclude_admins', $path ),
diff --git src/bp-groups/js/manage-members.js src/bp-groups/js/manage-members.js
index 34ef7dccb..69358a431 100644
--- src/bp-groups/js/manage-members.js
+++ src/bp-groups/js/manage-members.js
@@ -4,7 +4,7 @@
( function( wp, bp, $ ) {
// Bail if not set
- if ( typeof bpGroupManageMembersSettings === 'undefined' || ! bp.isRestEnabled ) {
+ if ( typeof bpGroupManageMembersSettings === 'undefined' ) {
return;
}
@@ -62,7 +62,7 @@
options.headers = { 'X-HTTP-Method-Override': 'PUT' };
}
- return bp.apiRequest( options );
+ return wp.apiRequest( options );
}
},
@@ -117,7 +117,7 @@
}
};
- return bp.apiRequest( options );
+ return wp.apiRequest( options );
}
}
} );
diff --git src/bp-members/bp-members-blocks.php src/bp-members/bp-members-blocks.php
index cd39942ac..3734cdffa 100644
--- src/bp-members/bp-members-blocks.php
+++ src/bp-members/bp-members-blocks.php
@@ -500,10 +500,7 @@ function bp_members_render_dynamic_members_block( $attributes = array() ) {
$path
);
- $preloaded_members = array();
- if ( bp_is_running_wp( '5.0.0' ) ) {
- $preloaded_members = rest_preload_api_request( '', $default_path );
- }
+ $preloaded_members = rest_preload_api_request( '', $default_path );
buddypress()->members->block_globals['bp/dynamic-members']->items[ $widget_id ] = (object) array(
'selector' => $widget_id,
diff --git src/bp-members/bp-members-template.php src/bp-members/bp-members-template.php
index 39cfd6e65..10e6ef071 100644
--- src/bp-members/bp-members-template.php
+++ src/bp-members/bp-members-template.php
@@ -2745,10 +2745,6 @@ function bp_signup_avatar_dir_value() {
* @return bool
*/
function bp_signup_requires_privacy_policy_acceptance() {
- // Bail if we're running a version of WP that doesn't have the Privacy Policy feature.
- if ( bp_is_running_wp( '4.9.6', '<' ) ) {
- return false;
- }
// Default to true when a published Privacy Policy page exists.
$privacy_policy_url = get_privacy_policy_url();
diff --git src/bp-settings/bp-settings-functions.php src/bp-settings/bp-settings-functions.php
index 12acd24f9..399966914 100644
--- src/bp-settings/bp-settings-functions.php
+++ src/bp-settings/bp-settings-functions.php
@@ -248,9 +248,7 @@ function bp_settings_get_personal_data_request( $user_id = 0 ) {
) );
if ( ! empty( $query->post ) ) {
- // WP 5.4 changed the user request function name to wp_get_user_request()
- $user_request = bp_is_running_wp( '4.9.6' ) ? 'wp_get_user_request' : 'wp_get_user_request_data';
- return $user_request( $query->post->ID );
+ return wp_get_user_request( $query->post->ID );
} else {
return false;
}
diff --git src/bp-settings/classes/class-bp-settings-component.php src/bp-settings/classes/class-bp-settings-component.php
index c39bff37e..eb7f0acb0 100644
--- src/bp-settings/classes/class-bp-settings-component.php
+++ src/bp-settings/classes/class-bp-settings-component.php
@@ -198,8 +198,8 @@ class BP_Settings_Component extends BP_Component {
*/
$show_data_page = apply_filters( 'bp_settings_show_user_data_page', true );
- // Export Data - only available for WP 4.9.6+.
- if ( true === $show_data_page && bp_is_running_wp( '4.9.6' ) ) {
+ // Export Data.
+ if ( true === $show_data_page ) {
$sub_nav[] = array(
'name' => __( 'Export Data', 'buddypress' ),
'slug' => 'data',
@@ -278,7 +278,7 @@ class BP_Settings_Component extends BP_Component {
$show_data_page = apply_filters( 'bp_settings_show_user_data_page', true );
// Export Data.
- if ( true === $show_data_page && bp_is_running_wp( '4.9.6' ) ) {
+ if ( true === $show_data_page ) {
$wp_admin_nav[] = array(
'parent' => 'my-account-' . $this->id,
'id' => 'my-account-' . $this->id . '-data',
diff --git src/class-buddypress.php src/class-buddypress.php
index e8f2a9797..981ae06a1 100644
--- src/class-buddypress.php
+++ src/class-buddypress.php
@@ -558,6 +558,7 @@ class BuddyPress {
require $this->plugin_dir . 'bp-core/deprecated/7.0.php';
require $this->plugin_dir . 'bp-core/deprecated/8.0.php';
require $this->plugin_dir . 'bp-core/deprecated/9.0.php';
+ require $this->plugin_dir . 'bp-core/deprecated/10.0.php';
}
// Load wp-cli module if PHP 5.6+.
diff --git src/readme.txt src/readme.txt
index 5e7eb3bfc..1a5e9b358 100644
--- src/readme.txt
+++ src/readme.txt
@@ -3,7 +3,7 @@ Contributors: johnjamesjacoby, DJPaul, boonebgorges, r-a-y, imath, mercime, tw21
Tags: user profiles, activity streams, messaging, friends, user groups, notifications, community, social networking, intranet
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
-Requires at least: 4.9
+Requires at least: 5.4
Requires PHP: 5.6
Tested up to: 5.8
Stable tag: 9.1.1