bp_members_validate_user_password( string $pass, string $confirm_pass, null|WP_User $userdata = null )

Validate a user password.


Parameters Parameters

$pass

(string) (Required) The password.

$confirm_pass

(string) (Required) The confirmed password.

$userdata

(null|WP_User) (Optional) Null or the userdata object when a member updates their password from front-end.

Default value: null


Top ↑

Return Return

(WP_Error) A WP error object possibly containing error messages.


Source Source

File: bp-members/bp-members-functions.php

function bp_members_validate_user_password( $pass, $confirm_pass, $userdata = null ) {
	$errors = new WP_Error();

	if ( ! $pass || ! $confirm_pass ) {
		$errors->add( 'missing_user_password', __( 'Please make sure you enter your password twice', 'buddypress' ) );
	}

	if ( $pass && $confirm_pass && $pass !== $confirm_pass ) {
		$errors->add( 'mismatching_user_password', __( 'The passwords you entered do not match.', 'buddypress' ) );
	}

	/**
	 * Filter here to add password validation errors.
	 *
	 * @since 7.0.0
	 *
	 * @param WP_Error     $errors       Password validation errors.
	 * @param string       $pass         The password.
	 * @param string       $confirm_pass The confirmed password.
	 * @param null|WP_User $userdata     Null or the userdata object when a member updates their password from front-end.
	 */
	return apply_filters( 'bp_members_validate_user_password', $errors, $pass, $confirm_pass, $userdata );
}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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