• Resolved intarwebsdeveloper

    (@intarwebsdeveloper)


    Is there a way to customize the directory search so it only searches specific user data fields? Example, I only want the search to search the City and State fields so the only search results will be if the city or state matches the user profile.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @intarwebsdeveloper

    Have you tried using the Admin filter in the Member Directory?

    Please go to WP Admin > Ultimate Member > Member Directory > Edit/Add a Directory > Scroll at the bottom page and see “Search Options” > see “Admin filtering”. You can add filters as default search filters.

    Regards,

    Thread Starter intarwebsdeveloper

    (@intarwebsdeveloper)

    Hello @champsupertramp

    I did try using the Admin filter and it’s not working the way I need it to. When I choose the City field, it makes me choose a City in order to add the filter. And then the Search will ony query that specific City, which is incorrect. I need the search to only query the City field and (an additional user meta field if possible) instead of searching all the user fields of the profile.

    Thanks

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @intarwebsdeveloper

    Do you want the main search bar in the member directory to search for City and State fields only? We haven’t done this customization so I can only provide hooks that could help you:

    Filter hook: `um_prepare_user_query_args’
    Parameters: $query_args & $directory_settings

    Sample usage:

    add_filter("um_prepare_user_query_args","um_012621_prepare_user_query_args", 10, 2 );
    function um_012621_prepare_user_query_args( $args, $settings ){
       // do something with $args['meta_query'];
       return $args;
    }

    Regards,

    Thread Starter intarwebsdeveloper

    (@intarwebsdeveloper)

    Thanks, I’ll try this out.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

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

The topic ‘Customize Directory Search’ is closed to new replies.