Skip to:
Content

BuddyPress.org

Changeset 10458


Ignore:
Timestamp:
01/22/2016 05:52:29 PM (5 years ago)
Author:
boonebgorges
Message:

Introduce bp_get_members_member_type_base().

BP 2.3 introduced member-type-specific directories. These directory URLs are
built using a member-type prefix, as 'type' in example.com/members/type/foo/.
The current changeset moves the filtered value into its own function so that
it can be referenced elsewhere with minimal duplication.

See #6840.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r10417 r10458  
    283283
    284284            // Is this a member type directory?
    285             if ( ! bp_displayed_user_id() && $after_member_slug === apply_filters( 'bp_members_member_type_base', _x( 'type', 'member type URL base', 'buddypress' ) ) && ! empty( $bp_uri[ $uri_offset + 2 ] ) ) {
     285            if ( ! bp_displayed_user_id() && $after_member_slug === bp_get_members_member_type_base() && ! empty( $bp_uri[ $uri_offset + 2 ] ) ) {
    286286                $matched_types = bp_get_member_types( array(
    287287                    'has_directory'  => true,
  • trunk/src/bp-members/bp-members-template.php

    r10417 r10458  
    9898         */
    9999        return apply_filters( 'bp_get_members_root_slug', buddypress()->members->root_slug );
     100    }
     101
     102/**
     103 * Output the member type base slug.
     104 *
     105 * @since 2.5.0
     106 */
     107function bp_members_member_type_base() {
     108    echo esc_url( bp_get_members_member_type_base() );
     109}
     110    /**
     111     * Get the member type base slug.
     112     *
     113     * The base slug is the string used as the base prefix when generating member type directory URLs.
     114     * For example, in example.com/members/type/foo/, 'foo' is the member type and 'type' is the
     115     * base slug.
     116     *
     117     * @since 2.5.0
     118     *
     119     * @return string
     120     */
     121    function bp_get_members_member_type_base() {
     122        /**
     123         * Filters the member type URL base.
     124         *
     125         * @since 2.3.0
     126         *
     127         * @param string $base
     128         */
     129        return apply_filters( 'bp_members_member_type_base', _x( 'type', 'member type URL base', 'buddypress' ) );
    100130    }
    101131
Note: See TracChangeset for help on using the changeset viewer.