rcp_edit_profile_form_errors

Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code.

If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/

Triggers after the update profile form has been checked for errors. You can use this hook to validate your custom fields and add your own errors if they're not filled out.

Parameters:

  • $post (array) - Array of information sent via $_POST through the form.
  • $user_id (int) - ID of the user who is updating their profile.

Example:

Adds an error if a custom field isn't filled out.

function ag_rcp_edit_profile_form_errors( $post, $user_id ) {
	if ( empty( $post['my_custom_field'] ) ) {
		rcp_errors()->add( 'custom_field_empty', __( 'The custom field must be filled out.', 'rcp' ) );
	}
}
add_action( 'rcp_edit_profile_form_errors', 'ag_rcp_edit_profile_form_errors', 10, 2 );
Powered by Zendesk