Skip to:
Content

BuddyPress.org


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

    r13414 r13432  
    146146     * Set up globals for the Messages component.
    147147     *
    148      * The BP_MESSAGES_SLUG constant is deprecated, and only used here for
    149      * backwards compatibility.
     148     * The BP_MESSAGES_SLUG constant is deprecated.
    150149     *
    151150     * @since 1.5.0
     
    154153     */
    155154    public function setup_globals( $args = array() ) {
    156         $bp = buddypress();
    157 
    158         // Define a slug, if necessary.
    159         if ( ! defined( 'BP_MESSAGES_SLUG' ) ) {
    160             define( 'BP_MESSAGES_SLUG', $this->id );
     155        $bp           = buddypress();
     156        $default_slug = $this->id;
     157
     158        // @deprecated.
     159        if ( defined( 'BP_MESSAGES_SLUG' ) ) {
     160            _doing_it_wrong( 'BP_MESSAGES_SLUG', esc_html__( 'Slug constants are deprecated.', 'buddypress' ), 'BuddyPress 12.0.0' );
     161            $default_slug = BP_MESSAGES_SLUG;
    161162        }
    162163
     
    179180        // Note that global_tables is included in this array.
    180181        parent::setup_globals( array(
    181             'slug'                  => BP_MESSAGES_SLUG,
     182            'slug'                  => $default_slug,
    182183            'has_directory'         => false,
    183184            'notification_callback' => 'messages_format_notifications',
Note: See TracChangeset for help on using the changeset viewer.