Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using search_terms to manipulate members loop

  • Avatar of Henry
    Henry
    Participant

    @henrywright-1

    I am trying to manipulate the data returned by the members loop and am having trouble with the pagination when clicking on page 2, page 3 when a search value is provided.

    When I click on page 2, the results seem to forget the results returned by the search query and display all members.

    Why is it that this works (note I have hard coded the search_terms value to ‘paul':

    
    $args = array(
    	'search_terms'	=> 'paul',
    	'per_page'	=> 2
    );
    
    if ( bp_has_members( $args ) ) :
    

    Yet this doesn’t work:

    
    $search_terms = esc_html( $_REQUEST['search_text'] );
    
    $args = array(
    	'search_terms'	=> $search_terms,
    	'per_page'	=> 2
    );
    
    if ( bp_has_members( $args ) ) :
    

    http://codex.buddypress.org/developer/loops-reference/the-members-loop/

You must be logged in to reply to this topic.