diff --git a/admin/templates/form/profile_customize.php b/admin/templates/form/profile_customize.php index d7d7bb05..162b074d 100644 --- a/admin/templates/form/profile_customize.php +++ b/admin/templates/form/profile_customize.php @@ -139,7 +139,15 @@
- + ++ + + ui_on_off('_um_profile_photo_required'); ?> + + +
+diff --git a/core/um-actions-form.php b/core/um-actions-form.php index 429a3934..7c9b24a2 100644 --- a/core/um-actions-form.php +++ b/core/um-actions-form.php @@ -152,6 +152,10 @@ $form_id = $args['form_id']; $mode = $args['mode']; $fields = unserialize( $args['custom_fields'] ); + + if ( get_post_meta( $form_id, '_um_profile_photo_required', true ) && empty( $args['profile_photo'] ) ) { + $ultimatemember->form->add_error('profile_photo', sprintf(__('%s is required.','ultimatemember'), 'Profile Photo' ) ); + } if( isset( $fields ) && ! empty( $fields ) ){ foreach( $fields as $key => $array ) { @@ -162,6 +166,10 @@ $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) ); } + if ( isset( $array['type'] ) && $array['type'] == 'user_tags' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) ) { + $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) ); + } + if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) { $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) ); } diff --git a/core/um-actions-profile.php b/core/um-actions-profile.php index 2bd72d21..1366d4af 100644 --- a/core/um-actions-profile.php +++ b/core/um-actions-profile.php @@ -406,6 +406,12 @@ + + fields->is_error( 'profile_photo' ) ) { + echo $ultimatemember->fields->field_error( $ultimatemember->fields->show_error('profile_photo'), 'force_show' ); + } + ?>