Skip to content

Instantly share code, notes, and snippets.

@pippinsplugins
Last active November 15, 2017 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pippinsplugins/eea1456fe9254c5b10ab to your computer and use it in GitHub Desktop.
Save pippinsplugins/eea1456fe9254c5b10ab to your computer and use it in GitHub Desktop.
<?php
/**
* Determines if there are problems with the registration data submitted
*
*/
function pw_rcp_validate_user_fields_on_register( $posted ) {
if ( is_user_logged_in() ) {
return;
}
if( empty( $posted['rcp_profession'] ) ) {
rcp_errors()->add( 'invalid_profession', __( 'Please enter your profession', 'rcp' ), 'register' );
}
if( empty( $posted['rcp_location'] ) ) {
rcp_errors()->add( 'invalid_location', __( 'Please enter your location', 'rcp' ), 'register' );
}
}
add_action( 'rcp_form_errors', 'pw_rcp_validate_user_fields_on_register', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment