Category Archives: News

BP Profile Search 5.4.6

This new version of BP Profile Search adds debug information to the admin interface. This information will be very useful if you ever post a request in a BP Profile Search support forum, either:

https://wordpress.org/support/plugin/bp-profile-search/

or:

https://dontdream.it/support/forum/bp-profile-search-forum/

When you have a support request, go to:

Tools -> Site Health -> Info -> BP Profile Search

You will find some lines like these:

Version			5.4.6
Platform		BuddyPress 10.3.0
Theme			Twenty Thirteen 3.5
Members index template	/plugins/buddypress/bp-templates/...
Members loop template	/plugins/buddypress/bp-templates/...
Form template(s)	/plugins/bp-profile-search/templates/...

Copy those lines and paste them into your support request, and most of the times I’ll be able to answer your question more quickly.

BP Profile Search 5.4

BP Profile Search 5.4 no longer enqueues any scripts before calling a form template, see BP Profile Search 5.3.3 for all the details.

This may break custom form templates that rely on these scripts but don’t enqueue them. This change was announced more than one year ago, so I hope that all the custom form templates are now updated according to the above post.

Additionally, the filters template has been completely rewritten, in order to be easier to customize. If you did customize your filters template earlier, probably your customizations won’t work in version 5.4.

For the above reasons, I suggest to test this version on your staging site before installing it on your live site.

If you already installed version 5.4 and you wish to roll back to the previous version, you can easily do so with WP Rollback.

On the other hand, if you are not using any custom templates and have not applied any template customizations, these changes won’t affect you.

And as usual if you have questions, bug reports or suggestions, please feel free to use the plugin Support Forum.

BP Profile Search 5.3.3

This post is for developers who create custom form templates, final users don’t need to take any action (unless they created a custom template themselves).

Before calling a form template, BP Profile Search used to enqueue some scripts required by the default template, bps-form-default.

This was wrong, because templates are designed to be replaceable and each template should enqueue its own scripts. Moreover, the scripts required by bps-form-default were enqueued for every template.

Starting with version 5.3.3, bps-form-default enqueues its own scripts.

To avoid breaking custom templates that use bps-form-default scripts but don’t enqueue them, BP Profile Search will continue to enqueue those scripts for every template, but only for a limited time.

Custom templates should be modified, to enqueue the scripts they need, as soon as possible. Of course custom templates can include the same scripts as bps-form-default if needed, see the source file bps-form-default.php for reference.

Starting with version 5.4, BP Profile Search will no longer enqueue any scripts for any template.

BP Profile Search 5.3

To clean up the plugin code and simplify further development, version 5.3 no longer supports old form templates, see New form template structure.

To know if the templates you are using are supported in 5.3, look at the Template column in the admin page Users -> Profile Search. Templates whose name is shown in green or blue text are supported in 5.3, those shown in red text are not.

If you still need to use old form templates, keep using BP Profile Search 5.2.4. If you upgraded already, roll back to BP Profile Search 5.2.4, either manually or using the WP Rollback plugin.

In addition, the old shortcode [bps_display] has been removed. If you were still using it, you can now replace it with [bps_form].

Version 5.3 brings a few new features and bug fixes:

1. A search field can be marked as required

To do that, go to the Edit Form page and prefix the field Label with an asterisk, e.g.:

* City

If you prefer an alternative way to mark a field as required, you can add this code to your bp-custom.php file:

add_action ('bps_field_before_search_form', 'set_required');
function set_required ($f)
{
	if ($f->code == 'field_34')    // replace 34 with your field ID
	{
		// mark the field as required
		$f->required = true;
	}
}

2. A search field can be assigned a default value

To do that, add this code to your bp-custom.php file:

add_action ('bps_field_before_search_form', 'set_default');
function set_default ($f)
{
	if ($f->code == 'field_34')    // replace 34 with your field ID
	{
		// assign the default value
		$f->value = 100;
	}
}

3. A search field can be validated with custom rules

To do that, add this code to your bp-custom.php file:

add_filter ('bps_validate_field', 'validate_field', 10, 2);
function validate_field ($error_message, $f)
{
	if ($f->code == 'field_34')    // replace 34 with your field ID
	{
		// specify the field validation rule and error message
		if ($f->value <= 80)
			$error_message = 'Please enter a value > 80';
	}

	return $error_message;
}

Bug fixes

This version also fixes two bugs:

1. The pagination of search results in member directories not using AJAX;

2. A conflict with the group members template, resulting in the group members page not being displayed correctly sometimes.

The two bug fixes are also available in version 5.2.4; if you need them and can’t upgrade to 5.3, you can delete and then reinstall BP Profile Search 5.2.4.

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 create Google Place Autocomplete fields, and add them to your BP Profile Search forms, selecting either the new distance search mode or one of the usual text search modes contains, is, or is like.

I hope you’ll find this new plugin useful. For questions, suggestions and bug reports you can 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.