BP Profile Search 5.0.4

With this version you can:

— Translate the keywords AND and OR used in searches. For instance, to translate the keywords in Spanish, add these definitions to bp-custom.php:

define ('BPS_AND', ' Y ');	// AND in Spanish
define ('BPS_OR', ' O ');	// OR in Spanish

— Adjust the multiple select size in search forms, using the bps_field_before_search_form hook. For instance, add this code to bp-custom.php:

add_action ('bps_field_before_search_form', 'new_multiselect_size');
function new_multiselect_size ($f)
{
	if ($f->display == 'multiselectbox')
	{
		$f->multiselect_size = 6;
	}
}

Additionally, a bug happening when you used the bps_match_all hook has been fixed, and some minor adjustments to the bps-form-default template have been made.

BP Profile Search 5.0.2

When you search your Members directory for City is: London, there is no doubt that all the members in your search results live in London. There is no need to show the value of the City field, or to order the search results by City.

But if you search for City is: London OR Paris, or for City contains: York, then you can’t say where a member in your search results actually lives. In these cases BP Profile Search 5.0.2 shows the value of the City field, and offers the option to sort your search results by City.

You can disable this feature if you don’t need it. Simply add this code to your bp-custom.php file:

add_filter ('bps_sort_options', 'change_sort_options');
function change_sort_options ($sort_options)
{
	$sort_options = array ();
	return $sort_options;
}

add_filter ('bps_details', 'change_details');
function change_details ($details)
{
	$details = array ();
	return $details;
}

The [bps_directory] shortcode allows you to activate this feature independently of the current search.

[bps_directory show='field_4,field_36' order_by='field_4,field_40']

shows the fields with ID 4 and 36 in all your directory (or search results) entries, and offers the option to sort your directory (or search results) by the fields with ID 4 and 40.

Please note that [bps_directory] is not a standard shortcode. You can enter it in a new page, and you’ll get a new Members directory, or you can enter it in the standard Members directory page, and you’ll be able to customize the standard Members directory itself.

BP Profile Search 5.0.2 also fixes a potentially nasty privacy problem. This involves a possible backwards incompatibility, see Potential privacy problem fixed in 5.0.2 for details.

And, last but not least, version 5.0.2 features a much improved compatibility with GEO my WordPress. Enjoy!

Potential privacy problem fixed in 5.0.2

Note: If you are not using a link to run a search, you are not affected by this change, and you can upgrade BP Profile Search as usual.

BP Profile Search (BPS) allows to run a search from a link, a menu item, or a bookmark, using the members directory URL with a custom query string. The query string is the same string that BPS generates when you choose Form Method: GET in the Form Settings box.

The query string contains the ID of the form that generates the search. Previous BPS versions didn’t check the form ID, so users could manipulate the query string to run any possible search on your member profiles, even on fields with restricted visibility.

To fix this potential privacy breach, BP Profile Search 5.0.2 checks the form ID in the query string, and allows only the searches specified in that form.

The price of the fix is a backwards incompatibility if you are using a link to run a search on your site. In this case, you have to check that link and make sure it uses a valid form ID. For instance, if you used a link like:

http://your-site/members/?field_1_contains=john&bp_profile_search=50

make sure that your form with ID 50 allows for that search, and replace that link with:

http://your-site/members/?field_1_contains=john&bps_form=50

If you used a link like:

http://your-site/members/?field_1_contains=john&bp_profile_search

create a new search form that allows for that search, and replace that link with:

http://your-site/members/?field_1_contains=john&bps_form=75

where 75 is your new search form ID.

Please note that the key bp_profile_search is replaced by the key bps_form.

As already mentioned, if you are not using a link to run a search you are not affected by this change.

New form template structure

The original form template structure used by BP Profile Search is almost four years old now, and the need for a better structure, easier to customize and able to support new features, is becoming increasingly apparent.

The new structure is already in place, it’s used by the most recent form template, bps-form-default, and is described in my page Form Templates.

The old form templates are no longer updated with new features, and will stop working in January 2020. If, for some reasons, you’ll need to use old form templates after that date, you’ll be able to do so using the latest 2019 BP Profile Search version.

Starting with version 5.0, BP Profile Search warns you if you are using an old template, so you have plenty of time to switch to bps-form-default or to rewrite your custom templates, if you are using one, following the new structure.

A few WordPress themes come with their own custom BP Profile Search form templates. These templates should also be rewritten by the theme authors according to the new template structure, to make the new BP Profile Search features available to their customers.

Of course I’m ready to support both plugin users and theme authors in this transition. As usual, you can use the Support Forum for support requests, or my Contact page to contact me privately.

BP Distance Search

Following many user requests, today I’ve released BP Distance Search.

BP Distance Search adds a new Google Place Autocomplete field type to your BuddyPress extended profiles.

You can then add the Google Place Autocomplete fields to your BP Profile Search forms, selecting either the distance search mode or one of the usual text search modes contains, is, or is like.

This plugin has been written mainly as a reference implementation for those plugins that add a location field type to the BuddyPress profiles, and wish to make it available for a search by distance in BP Profile Search forms.

That means that BP Distance Search will work as described, will be supported and maintained, but most likely won’t be extended with new features. In other words, I’m not planning to write another Google maps plugin, I only wish to offer the search by distance to the many users who ask for it.

I hope you’ll find this new plugin useful. As usual, for questions, suggestions and bug reports please use the BP Profile Search Support Forum.

WPML compatibility

With BP Profile Search 4.9.1, the friendly and supportive WPML team have completed their compatibility testing, so now we can announce full compatibility between BP Profile Search and WPML itself.

Using BP Profile Search with WPML is really simple. The relevant user-entered strings (form title, field label, field description) are automatically registered for translation, so you only need to provide your translations and forget about it.

Of course, if something doesn’t work for you as intended, please feel free to use our Support Forum.

BP Profile Search 4.8.4

Version 4.8.4 introduces the ability to search for data in the Usermeta table.

Usermeta contains a variety of data, e.g. the user first name and last name, the user role(s), and many more, added either by WordPress core or by plugins.

Out of the box, BP Profile Search supports only a handful of Usermeta data: first_name, last_name, role, total_friend_count, total_group_count.

To add your favorite Usermeta data to that basic initial list, use the ‘bps_usermeta_keys’ filter hook, as follows:

add_filter ('bps_usermeta_keys', 'add_more_keys');
function add_more_keys ($keys)
{
// to add a key:
//
// $keys['meta_key'] = 'format';
//
// 'meta_key' is the meta_key from the usermeta table
// 'format' is one of: text, integer, decimal, date, set

	$keys['nickname'] = 'text';

// if a meta has options, specify them too

	$options = array (0 => 'Male', 1 => 'Female');
	$keys['gender'] = array ('text', $options);

// add as many keys as needed, then:

	return $keys;
}

BP Profile Search 4.8.3

BP Profile Search 4.8.3 introduces a new form template that’s compatible with the BuddyPress Nouveau template pack.

This plugin version also restricts the selection of the form template to the form edit page. It’s no longer possible to select a different form template in a shortcode or in a widget.

The contextual help section has been revised, and the documentation updated.

Unfortunately, the shortcode [bps_directory] is not working when the BuddyPress Nouveau template pack is selected, and I’m now looking into this.

BP Profile Search 4.8.1

Version 4.8.1 brings two often requested enhancements, and a necessary break of backwards compatibility.

1. The ability to search for data in the Users table, e.g. the user ID, login name, or registration date.

The full field list is: ID, user_login, user_email, user_url, user_registered, user_status, display_name. This list can be modified using the 'bps_users_columns' filter hook.

2. The ability to enable or disable the persistent search feature.

When persistent search is enabled, a search is cleared when the user hits the Clear button – this is now the default option.

When persistent search is disabled, a search is cleared when the user hits the Clear button, or navigates away from the results page – this used to be the default before version 4.7.7.

3. The old interface for custom profile field types has been removed, see my post On custom field types.

Unfortunately not all the affected plugins have been updated to the new interface, and in this case you won’t be able to use those field types in BP Profile Search 4.8.1 forms. If that’s a problem, please keep using BP Profile Search 4.8.

BP Profile Search 4.8

BP Profile Search 4.8 introduces the hidden filters feature.

Hidden filters are used within the [bps_directory] shortcode to build specific Members directories.

For instance, if you have a profile field (with ID 39) where Members can select their preferred pets (Cats, Dogs, …), you may want to build a directory showing only Members who prefer Cats. That’s easy, put this shortcode into an empty page:

[bps_directory field_39="Cats"]

Done! you have the directory of cat loving people.

You can build very specific Members directories using any number of hidden filters. All the search modes available to build search forms are also available as hidden filter types. See the Custom Directories page for additional details.