While it is a well known process to search for user profiles from the WordPress Dashboard, you will require a dedicated user profile management plugin to allow that search on the frontend. And what better user profile management plugin to do that than ProfileGrid. ProfileGrid offers you tons of features for creating and managing user profiles in WordPress. One of which is an advanced WordPress user search feature. Today, we are going to take a look at this feature in more detail.
However, this is not a beginner level article. To follow along with the steps mentioned below, you need to have ProfileGrid activated on your site and have a few User Groups and Profiles already created. If your website doesn’t have these, we recommend that you go though our official Starter Guide first. And then, have a look at some of the other articles on our Blog.
The WordPress User Search Shortcode
To setup the WordPress user search feature on the frontend, you need to have this shortcode added to a page – [profilegrid_users]
Conveniently, you get a page already created with this shortcode when ProfileGrid is activated on your site. Unless you delete this page manually, there shouldn’t be any need to create a new page with the shortcode again.
The permalink of this search page created by ProfileGrid is profilegrid-search. So if your site URL is https://www.mysite.com, then this page will be accessible on https://www.mysite.com/profilegrid-search.
Basic Search
When viewing the search page on the frontend, you’ll see the basic search option. This has a text box to enter in a text by which it’ll search the users. This is followed by a ‘RESET’ button and an ‘ADVANCE’ button. After the buttons, there is the list of User Profiles which are filtered according to the search parameters.
If no text is added to the search text box, you’ll see all the User Profiles listed here. Also, you can click on the ‘RESET’ button to clear all text from the search text box.
Advanced Search
With the advance search, things get a lot more interesting. Advanced search options are visible once you click on the ‘ADVANCE’ button that is next to the ‘RESET’ button below the search text box. As soon as you click on the ‘ADVANCE’ button, a new search filter will appear below it. This is the filter to select a User Group. When a User Groups is selected in this option, the search function will only work on that User Group.
Here’s an example:
I select the User Group “The Wanderers”. Then I search for the user by name “Shirley”. This will display only the user “Shirley S” and not “Shirley D” as “Shirley S” is a member of the User Group “The Wanderers” while “Shirley D” is not.
Now, this is not where the advance search ends. You can also filter Users based on which Group Fields they have added to their Profiles. A Group Field needs to be added to the Advanced Search options to allow search filter by that field. You can do this by visiting that Group Field’s edit page and enabling the ‘Display in Advance Search’ option in it. Once this is enabled, you will see the Group Field for selection along with the User Group filter option after clicking on the ‘ADVANCE’ button. WordPress user search results can now be filtered by their Group Fields as well.
Here’s an example:
I search for the user by name “Paul” and select the Group Field “Miles Travelled” to filter results. This will display only the user “Paul D” and not “Paul M” as “Paul D” has the Group Field “Miles Travelled” added to his User Profile, while it is not added to “Paul M”.
Hey guys, I currently use this page to serve as a directory. I need to be able to sort by something other than an ID. Is this on your roadmap? Is our roadmap public to view?
Hello copyflightco,
Sorting options for the search page is on our roadmap. The roadmap is not publicly available though.
Once the sorting options are ready, you’ll be able to see the update in the plugin’s changelog.
Hi
Is postcode search available for this plugin?
Thanks
Ches
Hello, I am using your plugin and I do not know how to limit the number of displays per page neither on the list of users nor on the list of articles in the profile
You may change the $limit variable value to change users per page in php file located at ‘wp-content\plugins\profilegrid-user-profiles-groups-and-communities\public\partials\profile-magic-group.php’.
Please note that customisation of code will be wiped out with each update of plugin.
Hi there, is there a way to change the text on the ‘Advance’ button?
Cheers
You can change the text on button creating a custom template. It can be achieved by copying and renaming the “default” folder inside “[plugin root]/public/partials/themes” to “[your current theme directory]/profilegrid-user-profiles-groups-and-communities/themes and edit HTML as required.
To change the search page template you need to edit the ‘search-tpl.php’ file.
For more details on the custom template, you may visit the link: https://profilegrid.co/creating-your-own-custom-templates/
Hello,
If a field is a select box, I thought the search for that field would appear as a select box allowing to filter the search on one of the values.
But no, this is only a checkbox to filter members having chosen any value in this field ? This appears to be weird and useless for me.
Or did I miss anything ?
ProfileGrid allows you to search field with checkbox, not by dropdown related to select box. We have noted and forwarded this requirement to our development team to add this feature in our future release.
Thank you for this great plugin. Is there a way of limiting the user search page to a specific user role? Another question will be, could I create different pages for different roles?
As of now, both of the required functions are not available. We have noted and forwarded this feature request to our development team to add these functions/features in one of our future releases.
Hi
I’m pleased with the result of the membership site I created with both Registration Magic and Profile Grid. I have some questions about the search feature.
1. Users can now search using all fields I used in my forms. Can I restrict that to just fields that I chose. I don’t see it useful to search for a member with a text field for instance.
2. How can I make it possible for users to search for just female or male users, or users living in a specific city or region?
3. How can I make it possible for users to search using multipe search words/fields (i.e gender, city, academic education or not, etc)
Hi,
You may configure the “Display in Advance Search” option with the ProfileGrid Group Manager >> Fields
Click on the Edit field option to achieve this.
You may put the text in the search box and check multiple fields to search using multiple search words/fields.
Improving the Search feature is in our roadmap and you will see more improvement soon.
Thank you,
Thank you for your help!
I have fixed the searchable fields acorrding to your recommendations and it worked.
I still need the users to be able to use multiple search words. I have tried this to click on city, region, gender and field of education. I then wrote in the text field a name of a city, a region, a gender and then a field of education. That didn’t work.
I understand that you’re working to develop the search feature and I would appreciate it if you give me a time frame as to when you think this will be resolved. I need to plan for my business.
Hi,
Sorry for the inconvenience. We cannot give you a definitive timeline on this, as our development team is engaged in some significant tasks which are already in our pipeline, but we will fix it very soon. Our team will inform you once it gets fixed.
Meanwhile, let us know if you have any other questions.
Thank you,
Thank you!
Here an idea for future development of the search feature:
I think users will need a way to shorten the result list after a search by removing profiles they don’t won’t to keep. If this is not possible then it will be useful if one could create a list from the search result.
I can for example search for talents and need to remove those who don’t match my requirements or click on profiles that seem interesting and create a list that I can save.
Hi,
Thank you for the valuable suggestion. We have noted and will forward this to our management team to review and add this feature in one of our future releases.
Thank you,
Hi,
is it possible to limit the advanced search component to a single group instead of all over the registered users?
Thanks,
Lorenzo
Currently, the advanced search cannot be restricted to one group only. We have noted this requirement and will review it for possible inclusion in our future updates.
Good morning and thank you for your attention,
is it possible to do a search by letter of the alphabet?
Display all the letters of the alphabet and if one is clicked, a search is launched on that letter.
Thank you for your reply.
Good day and best regards
While we do not have the feature as part of ProfileGrid, we can implement it with customization. If you are interested, please submit us a ticket via this link: https://metagauss.com/customization-help/