Skip to:
Content

BuddyPress.org

Ticket #6286: quickdraft.patch

File quickdraft.patch, 1.3 KB (added by imath, 7 years ago)
  • src/bp-core/bp-core-catchuri.php

    diff --git src/bp-core/bp-core-catchuri.php src/bp-core/bp-core-catchuri.php
    index 437aee6..b0ba37e 100644
    function bp_core_set_uri_globals() { 
    258258                // If members component, do more work to find the actual component
    259259                if ( 'members' == $match->key ) {
    260260
     261                        $bp->maybe_member_type = $bp->pages->members;
     262
    261263                        // Viewing a specific user
    262264                        if ( !empty( $bp_uri[$uri_offset + 1] ) ) {
    263265
  • src/bp-members/bp-members-actions.php

    diff --git src/bp-members/bp-members-actions.php src/bp-members/bp-members-actions.php
    index 2231b19..356867c 100644
    function bp_core_get_random_member() { 
    116116        bp_core_redirect( bp_core_get_user_domain( $user['users'][0]->id ) );
    117117}
    118118add_action( 'bp_actions', 'bp_core_get_random_member' );
     119
     120function bp_is_member_type() {
     121        $bp = buddypress();
     122
     123        if ( ! isset( $bp->maybe_member_type ) ) {
     124                return;
     125        }
     126
     127        $uri_parse_member_type = array_diff( $bp->unfiltered_uri, array( $bp->maybe_member_type->slug ) );
     128        $uri_parse_member_type = array_values( $uri_parse_member_type );
     129
     130        $member_types = bp_get_member_types();
     131
     132        if ( isset( $member_types[ $uri_parse_member_type[0] ] ) ) {
     133                $bp->current_component = $bp->members->id;
     134        }
     135}
     136add_action( 'bp_actions', 'bp_is_member_type', 1 );