[Updated April 20, 2012]
When I had a chance to look into BuddyPress, the ‘social networking in a box’ for WordPress, I noticed that a plugin to search, or filter, the members directory was still missing, and that prompted me to release BP Profile Search.
In this page you can find the updated documentation for BP Profile Search 3.0.
Features
BP Profile Search adds a configurable search form to your BuddyPress site, so visitors can find site members searching their extended profiles.
You can insert the search form in a post or page, or in a sidebar or widget area, or anywhere in your theme, e.g. in your Members Directory template file.
In all three cases when visitors click ‘Search’, they are served your Members Directory page showing their search results.
Configuration
After the standard manual or automatic plugin installation procedure, you can access the plugin admin page BuddyPress -> Profile Search, where you have the following options:
* Specify the HTML text for the form header and welcome message.
* Enable the toggle form feature.
* Select the profile fields to include in the search form (currently the datebox profile fields are not supported).
* If your extended profiles include a birth date field, enable the age range search, so your visitors can specify the minimum and maximum age for their search.
* Select the members list to filter, if your Members Directory page contains more than one.
* Select the search mode for text fields, between:
– partial match, where a search for John matches John, Johnson, or Long John Silver;
– exact match, where a search for John matches John only.
In both search modes the wildcard characters % (percent sign), matching zero or more characters, and _ (underscore), matching exactly one character, are available to your visitors to better specify their search.
Displaying the search form
There are three different ways to integrate your BP Profile Search form in your BuddyPress site. You can insert the form:
a) in a post or page, using the shortcode [bp_profile_search_form]
b) in a sidebar or widget area, using the BP Profile Search widget
c) in your template files, e.g. in your Members Directory page, using the code
<?php do_action (‘bp_profile_search_form’); ?>
Shortcodes and widgets are standard WordPress features, so I won’t explain their usage here. Adding the search form in your template files is also very simple, as shown in the following example.
If you wish to add the search form to your Members Directory page, and you are using the BuddyPress default theme, open index.php in the buddypress/bp-themes/bp-default/members folder, locate the line:
</div><!-- #members-dir-search -->
and, right after that, insert the BP Profile Search form:
<?php do_action ('bp_profile_search_form'); ?>
If you are not using the BuddyPress default theme, the procedure might be different.
Troubleshooting
If your searches always return the full members list, try changing the Filtered Members List value in BuddyPress -> Profile Search, Advanced Options tab.
Conclusions
I hope you find this plugin useful and help me improve it, with your suggestions, bug reports, and patches. BP Profile Search is available for download in the WordPress Plugin Directory and in the BuddyPress Plugin Directory.
Recent Comments