Add option to Switch on/off the profile photo uploader

This commit is contained in:
denisbaranov
2019-06-04 19:21:36 +03:00
parent 572f47033f
commit 5c71255d66
3 changed files with 2638 additions and 2613 deletions
File diff suppressed because it is too large Load Diff
@@ -123,11 +123,23 @@
'conditional' => array( '_um_profile_cover_enabled', '=', 1 )
),
array(
'id' => '_um_profile_photosize',
'id' => '_um_profile_photo_uploader',
'type' => 'select',
'label' => __( 'Profile Photo Uploader','ultimate-member' ),
'tooltip' => __('Switch on/off the profile photo uploader','ultimate-member'),
'value' => UM()->query()->get_meta_value( '_um_profile_photo_uploader', null, UM()->options()->get( 'profile_photo_uploader' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
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' ) ),
'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(
+7 -1
View File
@@ -710,6 +710,12 @@ function um_profile_header( $args ) {
</span>
</span>';
// Switch on/off the profile photo uploader
$photo_uploader = empty( $args['use_custom_settings'] ) ? UM()->options()->get( 'profile_photo_uploader' ) : $args['photo_uploader'];
if( !$photo_uploader ){
$args['photo_uploader'] = 0;
$overlay = '';
}
?>
<div class="um-header<?php echo $classes; ?>">
@@ -743,7 +749,7 @@ function um_profile_header( $args ) {
<?php
if ( ! isset( UM()->user()->cannot_edit ) ) {
if ( $photo_uploader && empty( UM()->user()->cannot_edit ) ) {
UM()->fields()->add_hidden_field( 'profile_photo' );