BP_Members_Suggestions::validate()
Validate and sanitise the parameters for the suggestion service query.
Description
Return
(true|WP_Error) If validation fails, return a WP_Error object. On success, return true (bool).
Source
File: bp-core/classes/class-bp-members-suggestions.php
public function validate() {
$this->args['only_friends'] = (bool) $this->args['only_friends'];
/**
* Filters the members suggestions args for the current user.
*
* @since BuddyPress 2.1.0
*
* @param array $args Array of arguments for the member suggestions.
* @param BP_Members_Suggestions $this Current BP_Members_Suggestions instance.
*/
$this->args = apply_filters( 'bp_members_suggestions_args', $this->args, $this );
// Check for invalid or missing mandatory parameters.
if ( $this->args['only_friends'] && ( ! bp_is_active( 'friends' ) || ! is_user_logged_in() ) ) {
return new WP_Error( 'missing_requirement' );
}
/**
* Filters the validation status for the suggestion service query.
*
* @since BuddyPress 2.1.0
*
* @param bool|WP_Error $value Results of validation check.
* @param BP_Members_Suggestions $this Current BP_Members_Suggestions instance.
*/
return apply_filters( 'bp_members_suggestions_validate_args', parent::validate(), $this );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.