BP_Members_Suggestions::validate()

Validate and sanitise the parameters for the suggestion service query.


Description Description


Return Return

(true|WP_Error) If validation fails, return a WP_Error object. On success, return true (bool).


Top ↑

Source 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 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 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 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.