Skip to:
Content

BuddyPress.org

Ticket #5087: 5087.diff

File 5087.diff, 2.4 KB (added by boonebgorges, 4 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 e0cdf60..6a45c72 100644
    function bp_core_set_uri_globals() { 
    322322                }
    323323        }
    324324
    325         // Set the current action
    326         $bp->current_action = isset( $bp_uri[$uri_offset + 1] ) ? $bp_uri[$uri_offset + 1] : '';
     325        // Determine the current action.
     326        $current_action = isset( $bp_uri[$uri_offset + 1] ) ? $bp_uri[$uri_offset + 1] : '';
     327
     328        /*
     329         * If a BuddyPress directory is set to the WP front page, URLs like example.com/members/?s=foo
     330         * shouldn't interfere with blog searches.
     331         */
     332        if ( empty( $current_action) && ! empty( $_GET['s'] ) && 'page' == get_option( 'show_on_front' ) && ! empty( $match->id ) ) {
     333                $page_on_front = (int) get_option( 'page_on_front' );
     334                if ( (int) $match->id === $page_on_front ) {
     335                        $bp->current_component = '';
     336                        return false;
     337                }
     338        }
     339
     340        $bp->current_action = $current_action;
    327341
    328342        // Slice the rest of the $bp_uri array and reset offset
    329343        $bp_uri      = array_slice( $bp_uri, $uri_offset + 2 );
  • src/bp-members/bp-members-template.php

    diff --git src/bp-members/bp-members-template.php src/bp-members/bp-members-template.php
    index f4d482f..ba9dfcf 100644
    function bp_has_members( $args = '' ) { 
    590590        if ( is_null( $r['search_terms'] ) ) {
    591591                if ( !empty( $_REQUEST['s'] ) ) {
    592592                        $r['search_terms'] = $_REQUEST['s'];
     593                } elseif ( ! empty( $_REQUEST['members_s'] ) ) {
     594                        $r['search_terms'] = $_REQUEST['members_s'];
    593595                } else {
    594596                        $r['search_terms'] = false;
    595597                }
    function bp_member_hidden_fields() { 
    13351337function bp_directory_members_search_form() {
    13361338
    13371339        $default_search_value = bp_get_search_default_text( 'members' );
    1338         $search_value         = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value;
     1340        $search_value         = !empty( $_REQUEST['members_s'] ) ? stripslashes( $_REQUEST['members_s'] ) : $default_search_value;
    13391341
    13401342        $search_form_html = '<form action="" method="get" id="search-members-form">
    1341                 <label><input type="text" name="s" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
     1343                <label><input type="text" name="members_s" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
    13421344                <input type="submit" id="members_search_submit" name="members_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
    13431345        </form>';
    13441346