diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 4bbae5bd..ef01be07 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -782,6 +782,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'tooltip' => __('You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member'), 'upload_frame_title'=> __('Select Default Cover Photo', 'ultimate-member'), ), + array( + 'id' => 'disable_profile_photo_upload', + 'type' => 'checkbox', + 'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ), + 'tooltip' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ), + ), array( 'id' => 'profile_photosize', 'type' => 'text', diff --git a/includes/admin/templates/form/profile_customize.php b/includes/admin/templates/form/profile_customize.php index 2bed0abb..290445ee 100644 --- a/includes/admin/templates/form/profile_customize.php +++ b/includes/admin/templates/form/profile_customize.php @@ -123,45 +123,57 @@ 'conditional' => array( '_um_profile_cover_enabled', '=', 1 ) ), array( - 'id' => '_um_profile_photosize', - 'type' => 'text', - 'label' => __( 'Profile Photo Size', 'ultimate-member' ), - 'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ), - 'value' => UM()->query()->get_meta_value( '_um_profile_photosize', null, UM()->options()->get( 'profile_photosize' ) ), - 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ) - ), - array( - 'id' => '_um_profile_photo_required', - 'type' => 'select', - 'label' => __( 'Make Profile Photo Required', 'ultimate-member' ), - 'tooltip' => __( 'Require user to update a profile photo when updating their profile', 'ultimate-member' ), - 'value' => UM()->query()->get_meta_value( '_um_profile_photo_required' ), - 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ), - 'options' => array( - 0 => __( 'No', 'ultimate-member' ), - 1 => __( 'Yes', 'ultimate-member' ), + 'id' => '_um_profile_disable_photo_upload', + 'type' => 'select', + 'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ), + 'tooltip' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ), + 'value' => UM()->query()->get_meta_value( '_um_profile_disable_photo_upload', null, UM()->options()->get( 'disable_profile_photo_upload' ) ), + 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ), + 'options' => array( + 0 => __( 'No', 'ultimate-member' ), + 1 => __( 'Yes', 'ultimate-member' ), ), ), array( - 'id' => '_um_profile_show_name', - 'type' => 'select', - 'label' => __( 'Show display name in profile header?', 'ultimate-member' ), - 'value' => UM()->query()->get_meta_value( '_um_profile_show_name', null, 1 ), - 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ), - 'options' => array( - 0 => __( 'No', 'ultimate-member' ), - 1 => __( 'Yes', 'ultimate-member' ), + 'id' => '_um_profile_photosize', + 'type' => 'text', + 'label' => __( 'Profile Photo Size', 'ultimate-member' ), + 'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ), + 'value' => UM()->query()->get_meta_value( '_um_profile_photosize', null, UM()->options()->get( 'profile_photosize' ) ), + 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ) + ), + array( + 'id' => '_um_profile_photo_required', + 'type' => 'select', + 'label' => __( 'Make Profile Photo Required', 'ultimate-member' ), + 'tooltip' => __( 'Require user to update a profile photo when updating their profile', 'ultimate-member' ), + 'value' => UM()->query()->get_meta_value( '_um_profile_photo_required' ), + 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ), + 'options' => array( + 0 => __( 'No', 'ultimate-member' ), + 1 => __( 'Yes', 'ultimate-member' ), ), ), array( - 'id' => '_um_profile_show_social_links', - 'type' => 'select', - 'label' => __( 'Show social links in profile header?', 'ultimate-member' ), - 'value' => UM()->query()->get_meta_value( '_um_profile_show_social_links', null, UM()->options()->get( 'profile_show_social_links' ) ), - 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ), - 'options' => array( - 0 => __( 'No', 'ultimate-member' ), - 1 => __( 'Yes', 'ultimate-member' ), + 'id' => '_um_profile_show_name', + 'type' => 'select', + 'label' => __( 'Show display name in profile header?', 'ultimate-member' ), + 'value' => UM()->query()->get_meta_value( '_um_profile_show_name', null, 1 ), + 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ), + 'options' => array( + 0 => __( 'No', 'ultimate-member' ), + 1 => __( 'Yes', 'ultimate-member' ), + ), + ), + array( + 'id' => '_um_profile_show_social_links', + 'type' => 'select', + 'label' => __( 'Show social links in profile header?', 'ultimate-member' ), + 'value' => UM()->query()->get_meta_value( '_um_profile_show_social_links', null, UM()->options()->get( 'profile_show_social_links' ) ), + 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ), + 'options' => array( + 0 => __( 'No', 'ultimate-member' ), + 1 => __( 'Yes', 'ultimate-member' ), ), ), array( diff --git a/includes/class-config.php b/includes/class-config.php index 24190728..606bdadc 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -520,6 +520,7 @@ if ( ! class_exists( 'um\Config' ) ) { 'blocked_words' => 'admin' . "\r\n" . 'administrator' . "\r\n" . 'webmaster' . "\r\n" . 'support' . "\r\n" . 'staff', 'default_avatar' => '', 'default_cover' => '', + 'disable_profile_photo_upload' => 0, 'profile_show_metaicon' => 0, 'profile_menu' => 1, 'profile_menu_default_tab' => 'main', diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 38236521..2bbc46fd 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -273,15 +273,15 @@ function um_user_edit_profile( $args ) { $stripslashes = stripslashes( $stripslashes ); } if ( in_array( $array['type'], array( 'select' ) ) && - ! empty( $array['options'] ) && ! empty( $stripslashes ) && - ! in_array( $stripslashes, array_map( 'trim', $array['options'] ) ) && ! $has_custom_source ) { + ! empty( $array['options'] ) && ! empty( $stripslashes ) && + ! in_array( $stripslashes, array_map( 'trim', $array['options'] ) ) && ! $has_custom_source ) { continue; } //validation of correct values from options in wp-admin //the user cannot set invalid value in the hidden input at the page if ( in_array( $array['type'], array( 'multiselect', 'checkbox', 'radio' ) ) && - ! empty( $args['submitted'][ $key ] ) && ! empty( $array['options'] ) ) { + ! empty( $args['submitted'][ $key ] ) && ! empty( $array['options'] ) ) { $args['submitted'][ $key ] = array_map( 'stripslashes', array_map( 'trim', $args['submitted'][ $key ] ) ); $args['submitted'][ $key ] = array_intersect( $args['submitted'][ $key ], array_map( 'trim', $array['options'] ) ); } @@ -553,7 +553,7 @@ function um_profile_dynamic_meta_desc() { $user_id = um_user( 'ID' ); $url = um_user_profile_url(); - $avatar = um_get_user_avatar_url( $user_id, 'original' ); + $avatar = um_get_user_avatar_url( $user_id, 'original' ); um_reset_user(); ?> @@ -593,7 +593,7 @@ function um_profile_header_cover_area( $args ) { ?>
+ data-user_id="" data-ratio=""> + // Switch on/off the profile photo uploader + $disable_photo_uploader = empty( $args['use_custom_settings'] ) ? UM()->options()->get( 'disable_profile_photo_upload' ) : $args['disable_photo_upload']; + if ( $disable_photo_uploader ) { + $args['disable_photo_upload'] = 1; + $overlay = ''; + } else { + $overlay = ' '; - - ?> + } ?>
@@ -766,9 +771,7 @@ function um_profile_header( $args ) { - user()->cannot_edit ) ) { + user()->cannot_edit ) ) { UM()->fields()->add_hidden_field( 'profile_photo' ); @@ -839,35 +842,33 @@ function um_profile_header( $args ) { } - } - - ?> + } ?>
- - */ - do_action( 'um_before_profile_main_meta', $args ); ?> + + */ + do_action( 'um_before_profile_main_meta', $args ); ?>
@@ -971,10 +972,10 @@ function um_profile_header( $args ) {
+ data-character-limit="options()->get( 'profile_bio_maxchars' ); ?>" + placeholder="" + name="" + id="">fields()->field_value( 'description' ) ?> options()->get( 'profile_bio_maxchars' ); ?>