Monthly Archives: February 2020

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.