Skip to:
Content

BuddyPress.org

Ticket #6765: 6765-02b.patch

File 6765-02b.patch, 1.3 KB (added by imath, 4 years ago)
  • src/bp-core/classes/class-bp-component.php

    diff --git src/bp-core/classes/class-bp-component.php src/bp-core/classes/class-bp-component.php
    index 8a53680..b5e2cfb 100644
    class BP_Component { 
    226226         * }
    227227         */
    228228        public function setup_globals( $args = array() ) {
     229                $bp = buddypress();
    229230
    230231                /** Slugs ************************************************************
    231232                 */
    232233
    233234                // If a WP directory page exists for the component, it should
    234235                // be the default value of 'root_slug'.
    235                 $default_root_slug = isset( buddypress()->pages->{$this->id}->slug ) ? buddypress()->pages->{$this->id}->slug : '';
     236                $default_root_slug = isset( $bp->pages->{$this->id}->slug ) ? $bp->pages->{$this->id}->slug : '';
    236237
    237238                $r = wp_parse_args( $args, array(
    238239                        'slug'                  => $this->id,
    class BP_Component { 
    273274                $this->has_directory         = apply_filters( 'bp_' . $this->id . '_has_directory',         $r['has_directory']         );
    274275
    275276                /**
     277                 * Use the WordPress Page title as the directory page title if it exists.
     278                 */
     279                if ( $this->has_directory && ! empty( $bp->pages->{$this->id}->title ) ) {
     280                         $r['directory_title'] = $bp->pages->{$this->id}->title;
     281                }
     282
     283                /**
    276284                 * Filters the component's directory title.
    277285                 *
    278286                 * @since 2.0.0