BuddyDev

Search

Default search based on profile fields?

  • Participant
    Level: Initiated
    Posts: 11
    David on #11011

    Is there any function I can tap into to set a default search upon going to the members page? For example the search page will automatically generate a $_GET request based on specific profile fields and go to /members/?field_6=Teacher&field_8=apple for example, instead of the user having to manually select these fields and then submit the member search form.

    I know I can do something similar by adding a custom query to the members loops as designated here:
    https://codex.buddypress.org/developer/loops-reference/the-members-loop/

    But this does not change the form fields

  • Keymaster
    (BuddyDev Team)
    Posts: 24712
    Brajesh Singh on #11014

    Hi David,
    It can be easily accomplished using xprofile_query and generating proper links.

    I need to know where the links will be visible, how the user will be able to click on it?

  • Participant
    Level: Initiated
    Posts: 11
    David on #11020

    Hi Brajesh. Thank you for the reply. If a user will click on a button which brings to the members page (i.e. http://www.yoursite.com/members/), then when the page loads, fields will automatically be populated and a default search will be completed. That way, the url will most likely show like http://www.yoursite.com/members/?field_6=Teacher&field_8=apple for example. Does that make sense?

  • Participant
    Level: Initiated
    Posts: 11
    David on #11052

    Hi Brajesh. Awaiting your reply. Thank you.

You must be logged in to reply to this topic.

This topic is: not resolved