Skip to:
Content

BuddyPress.org

Changeset 7465


Ignore:
Timestamp:
10/23/2013 02:43:31 PM (11 years ago)
Author:
boonebgorges
Message:

Default to the component directory root_slug in BP_Component::setup_globals()

This change will make BP_Component extensions a bit easier to build, as it will
no longer be necessary to fish the component root_slug out of bp_pages
manually (in the majority of standard cases).

Fixes #3578

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-component.php

    r7454 r7465  
    172172     *           value is generally unused if the component has a root
    173173     *           directory (the slug will be overridden by the post_name of
    174      *           the directory page).
     174     *           the directory page). Default: the slug of the directory
     175     *           page if one is found, otherwise an empty string.
    175176     *     @type bool $has_directory Set to true if the component requires
    176177     *           an associated WordPress page.
     
    187188        /** Slugs *************************************************************/
    188189
     190        // If a WP directory page exists for the component, it should
     191        // be the default value of 'root_slug'.
     192        $default_root_slug = isset( buddypress()->pages->{$this->id}->slug ) ? buddypress()->pages->{$this->id}->slug : '';
     193
    189194        $r = wp_parse_args( $args, array(
    190195            'slug'                  => $this->id,
    191             'root_slug'             => '',
     196            'root_slug'             => $default_root_slug,
    192197            'has_directory'         => false,
    193198            'notification_callback' => '',
Note: See TracChangeset for help on using the changeset viewer.