Restrict Content Pro
rcp_password_form_errors
Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.
Note: This content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro
Fires during change-password processing after RCP’s built-in empty-field and password-mismatch checks, and before the new password is saved.
Add errors with rcp_errors()->add( $code, $message, 'password' ). If any errors remain, RCP does not update the password.
Parameters
$posted_data (array) – Raw $_POST from the password change request.
Examples
function mytheme_rcp_password_form_errors( $posted_data ) {
if ( ! empty( $posted_data['rcp_user_pass'] ) && false !== strpos( $posted_data['rcp_user_pass'], ' ' ) ) {
rcp_errors()->add(
'password_has_spaces',
__( 'Passwords cannot contain spaces.', 'mytheme' ),
'password'
);
}
}
add_action( 'rcp_password_form_errors', 'mytheme_rcp_password_form_errors' );
Related: rcp_before_password_form_errors, password_form shortcode.