Skip to:
Content

BuddyPress.org

Ticket #6840: member-type-directory-permalink.diff

File member-type-directory-permalink.diff, 1.7 KB (added by Offereins, 5 years ago)
  • src/bp-members/bp-members-template.php

    diff --git a/src/bp-members/bp-members-template.php b/src/bp-members/bp-members-template.php
    index 91baf1c..ed77bfb 100644
    a b function bp_members_directory_permalink() { 
    128128        }
    129129
    130130/**
     131 * Output member type directory permalink.
     132 *
     133 * @since 2.5.0
     134 *
     135 * @uses bp_get_member_type_directory_permalink()
     136 *
     137 * @param string $member_type Optional. Member type.
     138 */
     139function bp_member_type_directory_permalink( $member_type = '' ) {
     140        echo esc_url( bp_get_member_type_directory_permalink( $member_type ) );
     141}
     142        /**
     143         * Return member type directory permalink.
     144         *
     145         * @since 2.5.0
     146         *
     147         * @param string $member_type Optional. Member type.
     148         *
     149         * @return string
     150         */
     151        function bp_get_member_type_directory_permalink( $member_type = '' ) {
     152
     153                // Default to the current member type
     154                $type = bp_get_member_type_object( ! empty( $member_type ) ? $member_type : bp_get_current_member_type() );
     155
     156                // Bail when member type is not found or has no directory
     157                if ( ! $type || ! $type->has_directory )
     158                        return '';
     159
     160                // Define member type base
     161                $base = trailingslashit( apply_filters( 'bp_members_member_type_base', _x( 'type', 'member type URL base', 'buddypress' ) ) );
     162
     163                /**
     164                 * Filters the member type directory permalink.
     165                 *
     166                 * @since 2.5.0
     167                 *
     168                 * @param string $value Member type directory permalink.
     169                 * @param object $type Member type object.
     170                 */
     171                return apply_filters( 'bp_get_member_type_directory_permalink', trailingslashit( bp_get_members_directory_permalink() . $base . $type->directory_slug ), $type );
     172        }
     173
     174/**
    131175 * Output the sign-up slug.
    132176 *
    133177 * @since 1.5.0