User search

This topic contains 4 replies, has 2 voices, and was last updated by aannolfi aannolfi 5 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #20971
    aannolfi
    aannolfi
    Participant

    Hello, I am trying to create a user search form. I read almost all the available documentation but I didn’t manage to solve my problem.
    I have buddypress installed, I have custom wordpress/buddyoress (wp/bp)) user field (city, province, description, activity, etc…). I need to create a search form allowing the generic website visitor to search for user by means of dropdown selector (one for each custom field). is it possible? I managed to create a search box where visitors can type city name and getting the list of wp/bp user living in a specific city (if I search using more words such as tyiping city and province, I don’t get any result)

    #20977
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    In this case I’m afraid the drop-down selector is not possible, because buddyPress xprofile fields are not user meta fields (custom fields), so those cannot be used as filter criteria.
    I have cleaned up a bit the buddypress xprofile section, so that only the fields are selected, as for some reason the values were there as well.
    You can also enable the secondary logic, if you want to – so that you might get better results when multiple keywords are entered from different fields.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #20991
    aannolfi
    aannolfi
    Participant

    Many thanks for you reply.
    I am trying to use secondary logic but I have problem.

    Say we have to user located in city of Apricena (Emanuele Libero and Antonio Francesco Parisi) and only one is a DJ (Emanuele Libero)
    If I type “apricena” in search box I should have two results (Emanuele Libero and Antonio Francesco Parisi) – and this is fine. it works
    If I type “apricena dj” I should have one result (Emanuele Libero). Here I have problem. I didn’t manage to make it works. I get no result
    I enabled secondary logic “AND” with no result

    would this plugin “https://wordpress.org/plugins/advanced-custom-fields/” help in order to add user meta fields?

    Alessio

    #20998
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Alessio,

    I believe you might need the ‘OR’ secondary logic instead. I am not sure if that will return only the one result, as the xProfile fields are all separate fields, and the keyword logic applies on each field separately.

    I think ACF has a feature to add user meta fields, I think that should work. You should maybe try creating 1 or 2 fields for testing, but as far as I know, ACF uses regular user meta, so that should be okay.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #21003
    aannolfi
    aannolfi
    Participant

    Hi Ernest, the OR secondary logic returns 2 results. I check ACF and I’ll let you know.

    Many thanks,
    Alessio

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.