Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/01/2023 08:17:11 AM (20 months ago)
Author:
imath
Message:

BP Rewrites: introduce the bp_rewrites_get_url() function

Its role is to build every BuddyPress URL using the BP Rewrites API.

This commit also deprecates softly some key functions like bp_get_root_domain() to let us review (thanks to deprecated notices) all BuddyPress links during 12.0 development cycle and make them use the introduced bp_rewrites_get_url() function or a wrapper of it. Once all replacements achieved, we'll need to fully deprecate:

  • bp_get_root_domain()
  • bp_root_domain()
  • bp_core_get_root_domain()

Slug constants have also been completely deprecated as we will be able to customize every slugs from the future "URL" tab of the BuddyPress settings page.

The $bp->root_domain BuddyPress global has been deprecated in favor of $bp->root_url.

Finally, the Components $rewrite_ids properties are now in place and corresponding rewrite rules are successfully generated.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes https://github.com/buddypress/buddypress/pull/69
See #4954

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/class-buddypress.php

    r13431 r13432  
    307307     */
    308308    public function __get( $key ) {
    309         return isset( $this->data[ $key ] ) ? $this->data[ $key ] : null;
     309        $valid_key = $key;
     310        if ( 'root_domain' === $key ) {
     311            _doing_it_wrong( 'root_domain', __( 'The root_domain BuddyPress main class property is deprecated since 12.0.0, please use the root_url property instead.', 'buddypress' ), 'BuddyPress 12.0.0' );
     312            $valid_key = 'root_url';
     313        }
     314
     315        return isset( $this->data[ $valid_key ] ) ? $this->data[ $valid_key ] : null;
    310316    }
    311317
     
    319325     */
    320326    public function __set( $key, $value ) {
    321         $this->data[ $key ] = $value;
     327        $valid_key = $key;
     328        if ( 'root_domain' === $key ) {
     329            _doing_it_wrong( 'root_domain', __( 'The root_domain BuddyPress main class property is deprecated since 12.0.0, please use the root_url property instead.', 'buddypress' ), 'BuddyPress 12.0.0' );
     330            $valid_key = 'root_url';
     331        }
     332
     333        $this->data[ $valid_key ] = $value;
    322334    }
    323335
Note: See TracChangeset for help on using the changeset viewer.