Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Prepare 1.4.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
imath committed Oct 29, 2022
1 parent 47bca6a commit 87090c5
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 30 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Change Log

## 1.4.0

_Requires WordPress 5.9_
_Tested up to WordPress 6.1_
_Requires BuddyPress 10.0_
_Tested up to BuddyPress 11.0-alpha_

### Description

BP Rewrites feature as a plugin maintenance release, please upgrade. With BP Rewrites activated, you'll get full control on any BuddyPress URLs.

### Changes

- Prevents a fatal error when trying to edit a nav too early. See [#42](https://github.com/buddypress/bp-rewrites/pull/42).
- Adds BP Specific exceptions to the "was called too early" notices. See [#43](https://github.com/buddypress/bp-rewrites/pull/43).

## Props

@imath.

---

## 1.3.0

_Requires WordPress 5.4_
Expand Down
22 changes: 13 additions & 9 deletions inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,8 @@ function disable_buddypress_legacy_url_parser() {
add_action( 'bp_parse_query', '_bp_maybe_remove_redirect_canonical', 20 );
add_action( 'bp_parse_query', 'bp_remove_adjacent_posts_rel_link', 20 );

/**
* On front-end, hook to `bp_parse_query` instead of `bp_init` to set up the navigation.
*
* @todo replace `apply_filters( 'wp_using_themes', defined( 'WP_USE_THEMES' ) && WP_USE_THEMES )`
* with `wp_using_themes()` once BP Required version is >= 5.1
*
* @see `bp_nav_menu_get_loggedin_pages()`
*/
if ( apply_filters( 'wp_using_themes', defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ) || wp_doing_ajax() || is_login_page() ) {
// On front-end, hook to `bp_parse_query` instead of `bp_init` to set up the navigation.
if ( wp_using_themes() || wp_doing_ajax() || is_login_page() ) {
remove_action( 'bp_init', 'bp_setup_nav', 6 );
add_action( 'bp_parse_query', 'bp_setup_nav', 12 );
}
Expand Down Expand Up @@ -584,3 +577,14 @@ function empty_form_action( $form_id = '' ) {
)
);
}

/**
* Checks if current context is a BuddyPress Ajax request.
*
* @since 1.4.0
*
* @return bool True if current context is a BuddyPress Ajax request. False otherwise.
*/
function is_bp_doing_ajax() {
return isset( buddypress()->ajax->WP );
}
2 changes: 1 addition & 1 deletion inc/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
function globals() {
$bpr = bp_rewrites();

$bpr->version = '1.3.0';
$bpr->version = '1.4.0';

// Path.
$plugin_dir = plugin_dir_path( dirname( __FILE__ ) );
Expand Down
4 changes: 2 additions & 2 deletions languages/bp-rewrites.pot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2022-06-25T08:27:28+00:00\n"
"POT-Creation-Date: 2022-10-29T09:06:33+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.5.0\n"
"X-Domain: bp-rewrites\n"
Expand Down Expand Up @@ -132,7 +132,7 @@ msgstr ""
msgid "Save Settings"
msgstr ""

#: src/bp-core/bp-core-template.php:72
#: src/bp-core/bp-core-template.php:96
msgid "Please wait for the `bp_parse_query` hook to be fired before using it."
msgstr ""

Expand Down
12 changes: 2 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bp-rewrites",
"version": "1.3.0",
"version": "1.4.0",
"description": "BuddyPress Rewrites development plugin",
"scripts": {
"pot": "wp i18n make-pot . languages/bp-rewrites.pot --exclude='.github,vendor' --headers='{\"Project-Id-Version\": \"BP Rewrites\", \"Report-Msgid-Bugs-To\": \"https://github.com/buddypress/bp-rewrites/issues\", \"Last-Translator\": \"JOHN JAMES JACOBY <[email protected]>\", \"Language-Team\": \"ENGLISH <[email protected]>\"}'"
Expand Down
13 changes: 11 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Requires at least: 5.9
Requires PHP: 5.6
Tested up to: 6.0
Stable tag: 1.3.0
Tested up to: 6.1
Stable tag: 1.4.0

The BP Rewrites plugin is a BuddyPress add-on giving you the full control of any BuddyPress generated URLs.

Expand Down Expand Up @@ -75,6 +75,10 @@ If you would like to provide monetary support to the BP Rewrites or BuddyPress p

== Upgrade Notice ==

= 1.4.0 =

Maintenance release. No specific upgrade routines are performed.

= 1.3.0 =

Maintenance release. No specific upgrade routines are performed.
Expand All @@ -93,6 +97,11 @@ Initial version of the plugin, no upgrade needed.

== Changelog ==

= 1.4.0 =

- Prevents a fatal error when trying to edit a nav too early.
- Adds BP Specific exceptions to the "was called too early" notices.

= 1.3.0 =

- Do not trigger "was called too early" notices for other WordPress specific contexts: signup, activation, comment submission and trackback management.
Expand Down
7 changes: 3 additions & 4 deletions src/bp-core/bp-core-template-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
* @param \WP_Query $posts_query WP_Query object.
*/
function bp_parse_query( $posts_query ) {
$bp = buddypress();
$bp_is_doing_ajax = isset( $bp->ajax->WP );

// Bail if $posts_query is not the main loop and not done in BP Ajax context.
if ( ! $bp_is_doing_ajax && ! $posts_query->is_main_query() ) {
if ( ! is_bp_doing_ajax() && ! $posts_query->is_main_query() ) {
return;
}

Expand All @@ -37,11 +35,12 @@ function bp_parse_query( $posts_query ) {
}

// Bail if in admin and not done in BP Ajax context.
if ( ! $bp_is_doing_ajax && is_admin() ) {
if ( ! is_bp_doing_ajax() && is_admin() ) {
return;
}

// Some Legacy Parser URL globals/filters need to be set at this time.
$bp = buddypress();
$bp->unfiltered_uri = bp_core_get_from_uri( array( 'unfiltered_uri' ) );
$bp->unfiltered_uri_offset = 0; // It's unclear how this is set for now. @todo review this.

Expand Down
2 changes: 1 addition & 1 deletion src/bp-core/classes/class-core-nav-compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function compat() {
/**
* Prevents a fatal error when trying to edit a nav too early.
*
* @since 1.3.1
* @since 1.4.0
*
* @param array $args The nav item's arguments.
* @param string $slug The slug of the nav item.
Expand Down

0 comments on commit 87090c5

Please sign in to comment.