Filter bp_has_members with bp_ajax_querystring

Home Forums BP Profile Search Forum Filter bp_has_members with bp_ajax_querystring

Viewing 8 posts - 15 through 22 (of 22 total)
  • Author
    Posts
  • #10818 Reply
    cobe
    Guest

    Hi again,
    Yes i would like to make search for the three City, Activity or Company Name fields in my three field groups, and also have list of all copanies name before make search.

    #10819 Reply
    andrea
    Keymaster

    Ok, I need all your field IDs so I can write the correct code for you.

    Field IDs of Company Name 1, 2 and 3: 89, 163, 164 (we already know them)
    Field IDs of City 1, 2 and 3: please provide them in the correct order
    Field IDs of Activity 1, 2 and 3: please provide them in the correct order

    #10820 Reply
    cobe
    Guest

    Field IDs of Company Name 1, 2 and 3: 89, 163, 164
    Field IDs of City 1, 2 and 3: 103, 180, 192
    Field IDs of Activity 1, 2 and 3: 94, 165, 184

    #10821 Reply
    andrea
    Keymaster

    The complete code is as follows:

    add_filter ('bps_field_sql', 'change_query', 10, 2);
    function change_query ($sql, $f)
    {
    // code for the company name fields
    	if ($f->code == 'field_89')  $sql['where']['field_id'] = 'field_id IN (89, 163, 164)';
    
    // add similar code for the other fields
    	if ($f->code == 'field_103')  $sql['where']['field_id'] = 'field_id IN (103, 180, 192)';
    	if ($f->code == 'field_94')  $sql['where']['field_id'] = 'field_id IN (94, 165, 184)';
    	return $sql;
    }

    Please let me know if it works as expected!

    #10822 Reply
    cobe
    Guest

    Hi again Andrea,
    with this shortcode bellow and your last code i have nothing in result.
    [bps_directory template="members/index-2, members/members-loop-2" field_89_like=% field_163_like=% field_164_like=%]
    When i used this shortcode bellow i got all compinies name 1 and search works perfectly for city name1 and activity1.
    [bps_directory template="members/index-2, members/members-loop-2" field_89_like=%]

    #10823 Reply
    andrea
    Keymaster

    Great! I’m glad we were able to find a working solution.

    #10824 Reply
    cobe
    Guest

    Hi Andrea,
    The snippet works just for one company but others no results, please can you share with me your email I order to send you my account for login on our website.
    Thank you.

    #10825 Reply
    andrea
    Keymaster

    Yes, you can share your info privately using my Contact page.

Viewing 8 posts - 15 through 22 (of 22 total)
Reply To: Filter bp_has_members with bp_ajax_querystring
Your information: