Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/08/2016 03:36:37 AM (8 years ago)
Author:
boonebgorges
Message:

When determining canonical URL, consider member type directories when 'page_on_front'.

bp_get_canonical_url() has some special logic for when
'page_on_front' is a BP component directory. This logic was introduced
before member and group type directories, so it did not account for
them.

The current changeset ensures that URLs of the format
example.com/members/type/foo do not redirect to example.com when
the Members directory is set to the home page.

The same problem doesn't arise for group type directories, because
the component/action stack works differently in the case of groups.

Fixes #7373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-catchuri.php

    r11099 r11281  
    853853        $front_page_component = array_search( $page_on_front, bp_core_get_directory_page_ids() );
    854854
    855         // If requesting the front page component directory, canonical
    856         // URL is the front page. We detect whether we're detecting a
    857         // component *directory* by checking that bp_current_action()
    858         // is empty - ie, this not a single item or a feed.
    859         if ( false !== $front_page_component && bp_is_current_component( $front_page_component ) && ! bp_current_action() ) {
     855        /*
     856         * If requesting the front page component directory, canonical
     857         * URL is the front page. We detect whether we're detecting a
     858         * component *directory* by checking that bp_current_action()
     859         * is empty - ie, this not a single item, a feed, or an item
     860         * type directory.
     861         */
     862        if ( false !== $front_page_component && bp_is_current_component( $front_page_component ) && ! bp_current_action() && ! bp_get_current_member_type() ) {
    860863            $bp->canonical_stack['canonical_url'] = trailingslashit( bp_get_root_domain() );
    861864
Note: See TracChangeset for help on using the changeset viewer.