Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/01/2023 08:17:11 AM (15 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/bp-friends/classes/class-bp-friends-component.php

    r13414 r13432  
    101101     * Set up bp-friends global settings.
    102102     *
    103      * The BP_FRIENDS_SLUG constant is deprecated, and only used here for
    104      * backwards compatibility.
     103     * The BP_FRIENDS_SLUG constant is deprecated.
    105104     *
    106105     * @since 1.5.0
     
    111110     */
    112111    public function setup_globals( $args = array() ) {
    113         $bp = buddypress();
    114 
    115         // Deprecated. Do not use.
    116         // Defined conditionally to support unit tests.
    117         if ( ! defined( 'BP_FRIENDS_DB_VERSION' ) ) {
    118             define( 'BP_FRIENDS_DB_VERSION', '1800' );
    119         }
    120 
    121         // Define a slug, if necessary.
    122         if ( ! defined( 'BP_FRIENDS_SLUG' ) ) {
    123             define( 'BP_FRIENDS_SLUG', $this->id );
     112        $bp           = buddypress();
     113        $default_slug = $this->id;
     114
     115        // @deprecated.
     116        if ( defined( 'BP_FRIENDS_DB_VERSION' ) ) {
     117            _doing_it_wrong( 'BP_FRIENDS_DB_VERSION', esc_html__( 'This constants is not used anymore.', 'buddypress' ), 'BuddyPress 12.0.0' );
     118        }
     119
     120        // @deprecated.
     121        if ( defined( 'BP_FRIENDS_SLUG' ) ) {
     122            _doing_it_wrong( 'BP_FRIENDS_SLUG', esc_html__( 'Slug constants are deprecated.', 'buddypress' ), 'BuddyPress 12.0.0' );
     123            $default_slug = BP_FRIENDS_SLUG;
    124124        }
    125125
     
    133133        // Note that global_tables is included in this array.
    134134        $args = array(
    135             'slug'                  => BP_FRIENDS_SLUG,
     135            'slug'                  => $default_slug,
    136136            'has_directory'         => false,
    137137            'search_string'         => __( 'Search Friends...', 'buddypress' ),
Note: See TracChangeset for help on using the changeset viewer.