Implementing a Custom Member Search Form for your Community Site
BuddyPress provides a default search form, but this only provides basic search functionality. To help in narrowing down of searches, you need to have a custom form that provides targeted results.
To bring this to light, we will need to install the BP Profile Search plugin. After download, the plugin can be installed from the Plugins > Add New section within your WordPress dashboard.
To implement the form, you will need to carry out the steps below:
Setup the Form
This can be achieved from the Users > Profile Search section within your WordPress dashboard.
On the next screen, you will need to fill in your form name as well as specify the fields that you would wish to have within the form.
The search mode section within the form enables you specify the type of search being carried out on that particular field.
Add the form to the members directory
You can then have the form set to be rendered within the members directory by setting the option “Add Form to Directory” to “Yes”.
Specify the Form Request Type
As for the search form, you will need to specify the “GET” form method.
Once this is done, you can then save your form.
Displaying the Form within your site
Apart from the display of the form within the member directory, as covered above, you can also display the form within other sections on your site.
1. On a sidebar or widget section within the site
This can be achieved by navigating to the Appearance > WIdgets section of your WordPresss dashboard and add the “Profile Search” widget to the section you wish to have the form rendered.
You will also need to select the form you created within the widget.
2. Within a page
The form can also be rendered on pages. This can be achieved by adding the Shortcode of the form to the page.
To find the forms shortcode, you will need to navigate to the Users > Profile Search section and check on your forms’ Shortcode towards the far right, on the Shortcode section.
Sample Form Display
With all the steps above carried out, you should then have a form within your site that performs a search on your members. Below is a sample view: