Skip to:
Content

BuddyPress.org

Ticket #4141: bp_get_permalink_function.patch

File bp_get_permalink_function.patch, 1.1 KB (added by chrisclayton, 12 years ago)

Not finished, needs work and advice.

  • bp-core-functions.php

     
    11221122        if ( 'remove_canonical_direct' == $redirect )
    11231123                remove_action( 'template_redirect', 'redirect_canonical' );
    11241124}
    1125 
     1125 /**
     1126 * Retrieve full permalink for currently displayed buddypress page.
     1127 *
     1128 * Todo: if we are on a subpage (eg. /profile) we need to get the rest of slug.
     1129 * @since Trunk 1.6
     1130 *
     1131 * @return $permalink Current page url
     1132*/
     1133function bp_get_permalink() {
     1134        if ( !bp_is_blog_page() && bp_displayed_user_id() && !is_404() ) {
     1135                $permalink = bp_displayed_user_domain();
     1136        }
     1137                       
     1138        if ( !bp_is_blog_page() && bp_is_groups_component() && bp_is_single_item() ) {
     1139                $permalink = trailingslashit( get_site_url() ) . trailingslashit( bp_get_groups_slug() ) . trailingslashit( bp_get_current_group_slug() );
     1140        }
     1141       
     1142        if ( bp_is_blog_page() ) { //This must be a WordPress page. Let them handle it.
     1143                $permalink = get_permalink();
     1144        }
     1145        return apply_filters('bp_get_permalink', $permalink);
     1146}
    11261147?>