- added ability to set cover/avatar size from predefined sizes in Ultimate Member -> Settings -> General -> Uploads;

This commit is contained in:
nikitasinelnikov
2019-10-10 17:22:24 +03:00
parent 097cfe8cb4
commit c81c52dda5
12 changed files with 717 additions and 577 deletions
+5 -3
View File
@@ -202,13 +202,15 @@
float: left;
position: absolute;
background: #fff;
padding: 5px;
/*left: 30px;*/
border-radius: 100%;
border: 5px solid #fff;
border-bottom: 5px solid #fff !important;/* rewrite ".um-header a" style */
overflow: hidden;
}
.um-profile-photo a.um-profile-photo-img img {
width: 100%;
height: 100%;
height: auto;
}
.um-profile-photo-overlay {
+6 -1
View File
@@ -152,6 +152,7 @@ div.uimob340 .um-profile-photo {
position: absolute;
top: -40px;
left: 0;
margin: 0;
}
div.uimob340 .um-header.no-cover .um-profile-photo {
@@ -353,6 +354,8 @@ div.uimob500 .um-profile-photo {
position: absolute;
top: -40px;
left: 0;
height: 80px !important;
margin: 0;
}
div.uimob500 .um-header.no-cover .um-profile-photo {
@@ -534,7 +537,8 @@ div.uimob800 .um-account-meta img {
}
div.uimob800 .um-profile-photo {
width: 200px !important;
width: 150px !important;
height: 80px !important;
}
div.uimob800 .um-profile-photo a.um-profile-photo-img {
@@ -566,6 +570,7 @@ div.uimob800 .um-cover-overlay
div.uimob960 .um-profile-photo {
width: 200px !important;
height: 80px !important;
}
div.uimob960 .um-profile-photo a.um-profile-photo-img {
+37 -31
View File
@@ -1,43 +1,49 @@
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
<style type="text/css">
<?php
$photosize = filter_var( $photosize, FILTER_SANITIZE_NUMBER_INT );
$photosize_up = ( $photosize / 2 ) + 10;
$meta_padding = ( $photosize + 60 ) . 'px';
<?php if ( ! $photosize || $photosize == 'original' ) {
//cannot be more than metadefault value
$photosize = um_get_metadefault( 'profile_photosize' );
}
$photosize = filter_var( $photosize, FILTER_SANITIZE_NUMBER_INT );
if ( $area_max_width ) {
print "
.um-$form_id.um .um-profile-body {
max-width: $area_max_width;
}
";
}
$photosize_up = ( $photosize / 2 ) + 10;
$meta_padding = ( $photosize + 60 ) . 'px';
print "
.um-$form_id.um .um-profile-photo a.um-profile-photo-img {
width: ".$photosize."px;
height: ".$photosize."px;
}
";
if ( $area_max_width ) {
print "
.um-$form_id.um .um-profile-body {
max-width: $area_max_width;
}
";
}
print "
.um-$form_id.um .um-profile-photo a.um-profile-photo-img {
top: -".$photosize_up."px;
}
";
if ( is_rtl() ) {
print "
.um-$form_id.um .um-profile-meta {
padding-right: $meta_padding;
.um-$form_id.um .um-profile-photo a.um-profile-photo-img {
width: ".$photosize."px;
height: ".$photosize."px;
}
";
} else {
print "
.um-$form_id.um .um-profile-meta {
padding-left: $meta_padding;
.um-$form_id.um .um-profile-photo a.um-profile-photo-img {
top: -".$photosize_up."px;
}
";
}
?>
if ( is_rtl() ) {
print "
.um-$form_id.um .um-profile-meta {
padding-right: $meta_padding;
}
";
} else {
print "
.um-$form_id.um .um-profile-meta {
padding-left: $meta_padding;
}
";
}
?>
</style>
+149 -138
View File
@@ -699,193 +699,204 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
'title' => __( 'Profile', 'ultimate-member' ),
'fields' => array(
array(
'id' => 'profile_template',
'type' => 'select',
'label' => __( 'Profile Default Template','ultimate-member' ),
'tooltip' => __( 'This will be the default template to output profile','ultimate-member' ),
'default' => um_get_metadefault('profile_template'),
'options' => UM()->shortcodes()->get_templates( 'profile' ),
'size' => 'small'
'id' => 'profile_template',
'type' => 'select',
'label' => __( 'Profile Default Template', 'ultimate-member' ),
'tooltip' => __( 'This will be the default template to output profile', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_template' ),
'options' => UM()->shortcodes()->get_templates( 'profile' ),
'size' => 'small'
),
array(
'id' => 'profile_max_width',
'type' => 'text',
'label' => __( 'Profile Maximum Width','ultimate-member' ),
'default' => um_get_metadefault('profile_max_width'),
'tooltip' => 'The maximum width this shortcode can take from the page width',
'size' => 'small'
'id' => 'profile_max_width',
'type' => 'text',
'label' => __( 'Profile Maximum Width', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_max_width' ),
'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ),
'size' => 'small'
),
array(
'id' => 'profile_area_max_width',
'type' => 'text',
'label' => __( 'Profile Area Maximum Width','ultimate-member' ),
'default' => um_get_metadefault('profile_area_max_width'),
'tooltip' => __('The maximum width of the profile area inside profile (below profile header)','ultimate-member'),
'size' => 'small'
'id' => 'profile_area_max_width',
'type' => 'text',
'label' => __( 'Profile Area Maximum Width', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_area_max_width' ),
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
'size' => 'small'
),
array(
'id' => 'profile_icons',
'type' => 'select',
'label' => __( 'Profile Field Icons','ultimate-member' ),
'tooltip' => __( 'This is applicable for edit mode only','ultimate-member' ),
'default' => um_get_metadefault('profile_icons'),
'options' => array(
'field' => __('Show inside text field','ultimate-member'),
'label' => __('Show with label','ultimate-member'),
'off' => __('Turn off','ultimate-member'),
'id' => 'profile_icons',
'type' => 'select',
'label' => __( 'Profile Field Icons', 'ultimate-member' ),
'tooltip' => __( 'This is applicable for edit mode only', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_icons' ),
'options' => array(
'field' => __( 'Show inside text field', 'ultimate-member' ),
'label' => __( 'Show with label', 'ultimate-member' ),
'off' => __( 'Turn off', 'ultimate-member' ),
),
'size' => 'small'
'size' => 'small'
),
array(
'id' => 'profile_primary_btn_word',
'type' => 'text',
'label' => __( 'Profile Primary Button Text','ultimate-member' ),
'default' => um_get_metadefault('profile_primary_btn_word'),
'tooltip' => __('The text that is used for updating profile button','ultimate-member'),
'id' => 'profile_primary_btn_word',
'type' => 'text',
'label' => __( 'Profile Primary Button Text','ultimate-member' ),
'default' => um_get_metadefault( 'profile_primary_btn_word' ),
'tooltip' => __( 'The text that is used for updating profile button', 'ultimate-member' ),
'size' => 'medium'
),
array(
'id' => 'profile_secondary_btn',
'type' => 'checkbox',
'label' => __( 'Profile Secondary Button', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_secondary_btn' ),
'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ),
),
array(
'id' => 'profile_secondary_btn_word',
'type' => 'text',
'label' => __( 'Profile Secondary Button Text', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_secondary_btn_word' ),
'tooltip' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ),
'conditional' => array( 'profile_secondary_btn', '=', 1 ),
'size' => 'medium'
),
array(
'id' => 'profile_secondary_btn',
'type' => 'checkbox',
'label' => __( 'Profile Secondary Button','ultimate-member' ),
'default' => um_get_metadefault('profile_secondary_btn'),
'tooltip' => __('Switch on/off the secondary button display in the form','ultimate-member'),
),
array(
'id' => 'profile_secondary_btn_word',
'type' => 'text',
'label' => __( 'Profile Secondary Button Text','ultimate-member' ),
'default' => um_get_metadefault('profile_secondary_btn_word'),
'tooltip' => __('The text that is used for cancelling update profile button','ultimate-member'),
'conditional' => array( 'profile_secondary_btn', '=', 1 ),
'size' => 'medium'
),
array(
'id' => 'default_avatar',
'type' => 'media',
'label' => __('Default Profile Photo', 'ultimate-member'),
'tooltip' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member'),
'upload_frame_title'=> __('Select Default Profile Photo', 'ultimate-member'),
'default' => array(
'url' => um_url . 'assets/img/default_avatar.jpg',
'id' => 'default_avatar',
'type' => 'media',
'label' => __( 'Default Profile Photo', 'ultimate-member' ),
'tooltip' => __( 'You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member' ),
'upload_frame_title' => __( 'Select Default Profile Photo', 'ultimate-member' ),
'default' => array(
'url' => um_url . 'assets/img/default_avatar.jpg',
),
),
array(
'id' => 'default_cover',
'type' => 'media',
'url' => true,
'preview' => false,
'label' => __('Default Cover Photo', 'ultimate-member'),
'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'),
'id' => 'default_cover',
'type' => 'media',
'url' => true,
'preview' => false,
'label' => __( 'Default Cover Photo', 'ultimate-member' ),
'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' ),
'default' => um_get_metadefault( 'disable_profile_photo_upload' ),
),
array(
'id' => 'profile_photosize',
'type' => 'text',
'label' => __( 'Profile Photo Size','ultimate-member' ),
'default' => um_get_metadefault('profile_photosize'),
'tooltip' => __('The global default of profile photo size. This can be overridden by individual form settings','ultimate-member'),
'id' => 'profile_photosize',
'type' => 'select',
'label' => __( 'Profile Photo Size', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_photosize' ),
'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ),
'tooltip' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ),
'size' => 'small'
),
array(
'id' => 'profile_cover_enabled',
'type' => 'checkbox',
'label' => __( 'Profile Cover Photos', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_cover_enabled' ),
'tooltip' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ),
),
array(
'id' => 'profile_coversize',
'type' => 'select',
'label' => __( 'Profile Cover Size', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_coversize' ),
'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ),
'tooltip' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ),
'conditional' => array( 'profile_cover_enabled', '=', 1 ),
'size' => 'small'
),
array(
'id' => 'profile_cover_enabled',
'type' => 'checkbox',
'label' => __( 'Profile Cover Photos','ultimate-member' ),
'default' => 1,
'tooltip' => __('Switch on/off the profile cover photos','ultimate-member'),
),
array(
'id' => 'profile_cover_ratio',
'type' => 'select',
'label' => __( 'Profile Cover Ratio','ultimate-member' ),
'tooltip' => __( 'Choose global ratio for cover photos of profiles','ultimate-member' ),
'default' => um_get_metadefault('profile_cover_ratio'),
'options' => array(
'1.6:1' => '1.6:1',
'2.7:1' => '2.7:1',
'2.2:1' => '2.2:1',
'3.2:1' => '3.2:1',
'id' => 'profile_cover_ratio',
'type' => 'select',
'label' => __( 'Profile Cover Ratio', 'ultimate-member' ),
'tooltip' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_cover_ratio' ),
'options' => array(
'1.6:1' => '1.6:1',
'2.7:1' => '2.7:1',
'2.2:1' => '2.2:1',
'3.2:1' => '3.2:1',
),
'conditional' => array( 'profile_cover_enabled', '=', 1 ),
'conditional' => array( 'profile_cover_enabled', '=', 1 ),
'size' => 'small'
),
array(
'id' => 'profile_show_metaicon',
'type' => 'checkbox',
'label' => __( 'Profile Header Meta Text Icon','ultimate-member' ),
'default' => 0,
'tooltip' => __('Display field icons for related user meta fields in header or not','ultimate-member'),
'id' => 'profile_show_metaicon',
'type' => 'checkbox',
'label' => __( 'Profile Header Meta Text Icon', 'ultimate-member' ),
'default' => 0,
'tooltip' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ),
),
array(
'id' => 'profile_show_name',
'type' => 'checkbox',
'label' => __( 'Show display name in profile header','ultimate-member' ),
'default' => um_get_metadefault('profile_show_name'),
'tooltip' => __('Switch on/off the user name on profile header','ultimate-member'),
'id' => 'profile_show_name',
'type' => 'checkbox',
'label' => __( 'Show display name in profile header', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_show_name' ),
'tooltip' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ),
),
array(
'id' => 'profile_show_social_links',
'type' => 'checkbox',
'label' => __( 'Show social links in profile header','ultimate-member' ),
'default' => um_get_metadefault('profile_show_social_links'),
'tooltip' => __('Switch on/off the social links on profile header','ultimate-member'),
'id' => 'profile_show_social_links',
'type' => 'checkbox',
'label' => __( 'Show social links in profile header', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_show_social_links' ),
'tooltip' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ),
),
array(
'id' => 'profile_show_bio',
'type' => 'checkbox',
'label' => __( 'Show user description in header','ultimate-member' ),
'default' => um_get_metadefault('profile_show_bio'),
'tooltip' => __('Switch on/off the user description on profile header','ultimate-member'),
'id' => 'profile_show_bio',
'type' => 'checkbox',
'label' => __( 'Show user description in header', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_show_bio' ),
'tooltip' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ),
),
array(
'id' => 'profile_show_html_bio',
'type' => 'checkbox',
'label' => __( 'Enable html support for user description','ultimate-member' ),
'default' => um_get_metadefault('profile_show_html_bio'),
'tooltip' => __('Switch on/off to enable/disable support for html tags on user description.','ultimate-member'),
'id' => 'profile_show_html_bio',
'type' => 'checkbox',
'label' => __( 'Enable HTML support for user description', 'ultimate-member' ),
'tooltip' => __( 'Switch on/off to enable/disable support for html tags on user description.', 'ultimate-member' ),
),
array(
'id' => 'profile_bio_maxchars',
'type' => 'text',
'label' => __( 'User description maximum chars','ultimate-member' ),
'default' => um_get_metadefault('profile_bio_maxchars'),
'tooltip' => __('Maximum number of characters to allow in user description field in header.','ultimate-member'),
'conditional' => array( 'profile_show_bio', '=', 1 ),
'id' => 'profile_bio_maxchars',
'type' => 'text',
'label' => __( 'User description maximum chars', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_bio_maxchars' ),
'tooltip' => __( 'Maximum number of characters to allow in user description field in header.', 'ultimate-member' ),
'conditional' => array( 'profile_show_bio', '=', 1 ),
'size' => 'small'
),
array(
'id' => 'profile_header_menu',
'type' => 'select',
'label' => __( 'Profile Header Menu Position', 'ultimate-member' ),
'default' => um_get_metadefault('profile_header_menu'),
'tooltip' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.','ultimate-member'),
'options' => array(
'bc' => __( 'Bottom of Icon', 'ultimate-member' ),
'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ),
'id' => 'profile_header_menu',
'type' => 'select',
'label' => __( 'Profile Header Menu Position', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_header_menu' ),
'tooltip' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimate-member' ),
'options' => array(
'bc' => __( 'Bottom of Icon', 'ultimate-member' ),
'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ),
),
'size' => 'small'
'size' => 'small'
),
array(
'id' => 'profile_empty_text',
'type' => 'checkbox',
'label' => __( 'Show a custom message if profile is empty','ultimate-member' ),
'default' => um_get_metadefault('profile_empty_text'),
'tooltip' => __('Switch on/off the custom message that appears when the profile is empty','ultimate-member'),
'id' => 'profile_empty_text',
'type' => 'checkbox',
'label' => __( 'Show a custom message if profile is empty', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_empty_text' ),
'tooltip' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ),
),
array(
'id' => 'profile_empty_text_emo',
'type' => 'checkbox',
'label' => __( 'Show the emoticon','ultimate-member' ),
'default' => um_get_metadefault('profile_empty_text_emo'),
'tooltip' => __('Switch on/off the emoticon (sad face) that appears above the message','ultimate-member'),
'conditional' => array( 'profile_empty_text', '=', 1 ),
'id' => 'profile_empty_text_emo',
'type' => 'checkbox',
'label' => __( 'Show the emoticon', 'ultimate-member' ),
'default' => um_get_metadefault( 'profile_empty_text_emo' ),
'tooltip' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ),
'conditional' => array( 'profile_empty_text', '=', 1 ),
)
)
),
@@ -16,14 +16,14 @@
'prefix_id' => 'form',
'fields' => array(
array(
'id' => '_um_profile_use_custom_settings',
'type' => 'select',
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling &amp; appearance', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_use_custom_settings', null, 0 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
'id' => '_um_profile_use_custom_settings',
'type' => 'select',
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling &amp; appearance', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_use_custom_settings', null, 0 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
@@ -37,93 +37,102 @@
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_template',
'type' => 'select',
'label' => __( 'Template', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_template', null, UM()->options()->get( 'profile_template' ) ),
'options' => UM()->shortcodes()->get_templates( 'profile' ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
'id' => '_um_profile_template',
'type' => 'select',
'label' => __( 'Template', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_template', null, UM()->options()->get( 'profile_template' ) ),
'options' => UM()->shortcodes()->get_templates( 'profile' ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_max_width',
'type' => 'text',
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_profile_max_width', null, UM()->options()->get( 'profile_max_width' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
'id' => '_um_profile_max_width',
'type' => 'text',
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_profile_max_width', null, UM()->options()->get( 'profile_max_width' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_area_max_width',
'type' => 'text',
'label' => __( 'Profile Area Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_profile_area_max_width', null, UM()->options()->get( 'profile_area_max_width' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
'id' => '_um_profile_area_max_width',
'type' => 'text',
'label' => __( 'Profile Area Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_profile_area_max_width', null, UM()->options()->get( 'profile_area_max_width' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_icons',
'type' => 'select',
'label' => __( 'Field Icons', 'ultimate-member' ),
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_icons', null, UM()->options()->get( 'profile_icons' ) ) ,
'options' => array(
'id' => '_um_profile_icons',
'type' => 'select',
'label' => __( 'Field Icons', 'ultimate-member' ),
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_icons', null, UM()->options()->get( 'profile_icons' ) ) ,
'options' => array(
'field' => __( 'Show inside text field', 'ultimate-member' ),
'label' => __( 'Show with label', 'ultimate-member' ),
'off' => __( 'Turn off', 'ultimate-member' )
'off' => __( 'Turn off', 'ultimate-member' )
),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_primary_btn_word',
'type' => 'text',
'label' => __( 'Primary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_primary_btn_word', null, UM()->options()->get( 'profile_primary_btn_word' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
'id' => '_um_profile_primary_btn_word',
'type' => 'text',
'label' => __( 'Primary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_primary_btn_word', null, UM()->options()->get( 'profile_primary_btn_word' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_secondary_btn',
'type' => 'select',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn', null, UM()->options()->get( 'profile_secondary_btn' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_secondary_btn_word',
'type' => 'text',
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn_word', null, UM()->options()->get( 'profile_secondary_btn_word' ) ),
'conditional' => array( '_um_profile_secondary_btn', '=', 1 )
),
array(
'id' => '_um_profile_cover_enabled',
'type' => 'select',
'label' => __( 'Enable Cover Photos', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_cover_enabled', null, 1 ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_cover_ratio',
'type' => 'select',
'label' => __( 'Cover photo ratio', 'ultimate-member' ),
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_cover_ratio', null, UM()->options()->get( 'profile_cover_ratio' ) ),
'options' => array(
'1.6:1' => '1.6:1',
'2.7:1' => '2.7:1',
'2.2:1' => '2.2:1',
'3.2:1' => '3.2:1'
'id' => '_um_profile_secondary_btn',
'type' => 'select',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn', null, UM()->options()->get( 'profile_secondary_btn' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
'conditional' => array( '_um_profile_cover_enabled', '=', 1 )
),
array(
'id' => '_um_profile_secondary_btn_word',
'type' => 'text',
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn_word', null, UM()->options()->get( 'profile_secondary_btn_word' ) ),
'conditional' => array( '_um_profile_secondary_btn', '=', 1 )
),
array(
'id' => '_um_profile_cover_enabled',
'type' => 'select',
'label' => __( 'Enable Cover Photos', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_cover_enabled', null, 1 ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_coversize',
'type' => 'select',
'label' => __( 'Cover Photo Size', 'ultimate-member' ),
'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_coversize', null, UM()->options()->get( 'profile_coversize' ) ),
'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ),
'conditional' => array( '_um_profile_cover_enabled', '=', 1 )
),
array(
'id' => '_um_profile_cover_ratio',
'type' => 'select',
'label' => __( 'Cover photo ratio', 'ultimate-member' ),
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_cover_ratio', null, UM()->options()->get( 'profile_cover_ratio' ) ),
'options' => array(
'1.6:1' => '1.6:1',
'2.7:1' => '2.7:1',
'2.2:1' => '2.2:1',
'3.2:1' => '3.2:1'
),
'conditional' => array( '_um_profile_cover_enabled', '=', 1 )
),
array(
'id' => '_um_profile_disable_photo_upload',
@@ -139,10 +148,11 @@
),
array(
'id' => '_um_profile_photosize',
'type' => 'text',
'type' => 'select',
'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' ) ),
'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
+54 -46
View File
@@ -224,51 +224,58 @@ if ( ! class_exists( 'um\Config' ) ) {
* ?>
*/
$this->core_form_meta_all = apply_filters( 'um_core_form_meta_all', array(
'_um_profile_show_name' => 1,
'_um_profile_show_social_links' => 0,
'_um_profile_show_bio' => 1,
'profile_show_html_bio' => 0,
'_um_profile_bio_maxchars' => 180,
'_um_profile_header_menu' => 'bc',
'_um_profile_empty_text' => 1,
'_um_profile_empty_text_emo' => 1,
'_um_profile_role' => array(),
'_um_profile_template' => 'profile',
'_um_profile_max_width' => '1000px',
'_um_profile_area_max_width' => '600px',
'_um_profile_align' => 'center',
'_um_profile_icons' => 'label',
'_um_profile_cover_enabled' => 1,
'_um_profile_disable_photo_upload' => 0,
'_um_profile_cover_ratio' => '2.7:1',
'_um_profile_photosize' => '190px',
'_um_profile_photocorner' => '1',
'_um_profile_header_bg' => '',
'_um_profile_primary_btn_word' => 'Update Profile',
'_um_profile_secondary_btn' => '1',
'_um_profile_secondary_btn_word' => 'Cancel',
'_um_register_role' => '0',
'_um_register_template' => 'register',
'_um_register_max_width' => '450px',
'_um_register_align' => 'center',
'_um_register_icons' => 'label',
'_um_register_primary_btn_word' => __('Register','ultimate-member'),
'_um_register_secondary_btn' => 1,
'_um_register_secondary_btn_word' => __('Login','ultimate-member'),
'_um_register_secondary_btn_url' => '',
'_um_login_template' => 'login',
'_um_login_max_width' => '450px',
'_um_login_align' => 'center',
'_um_login_icons' => 'label',
'_um_login_primary_btn_word' => __('Login','ultimate-member'),
'_um_login_forgot_pass_link' => 1,
'_um_login_show_rememberme' => 1,
'_um_login_secondary_btn' => 1,
'_um_login_secondary_btn_word' => __('Register','ultimate-member'),
'_um_login_secondary_btn_url' => '',
'_um_directory_template' => 'members',
'_um_directory_header' => __('{total_users} Members','ultimate-member'),
'_um_directory_header_single' => __('{total_users} Member','ultimate-member'),
/*Profile Form*/
'_um_profile_show_name' => 1,
'_um_profile_show_social_links' => 0,
'_um_profile_show_bio' => 1,
'_um_profile_bio_maxchars' => 180,
'_um_profile_header_menu' => 'bc',
'_um_profile_empty_text' => 1,
'_um_profile_empty_text_emo' => 1,
'_um_profile_role' => array(),
'_um_profile_template' => 'profile',
'_um_profile_max_width' => '1000px',
'_um_profile_area_max_width' => '600px',
'_um_profile_align' => 'center',
'_um_profile_icons' => 'label',
'_um_profile_disable_photo_upload' => 0,
'_um_profile_photosize' => '190',
'_um_profile_cover_enabled' => 1,
'_um_profile_coversize' => 'original',
'_um_profile_cover_ratio' => '2.7:1',
'_um_profile_photocorner' => '1',
'_um_profile_header_bg' => '',
'_um_profile_primary_btn_word' => __( 'Update Profile', 'ultimate-member' ),
'_um_profile_secondary_btn' => '1',
'_um_profile_secondary_btn_word' => __( 'Cancel', 'ultimate-member' ),
/*Registration Form*/
'_um_register_role' => '0',
'_um_register_template' => 'register',
'_um_register_max_width' => '450px',
'_um_register_align' => 'center',
'_um_register_icons' => 'label',
'_um_register_primary_btn_word' => __( 'Register', 'ultimate-member' ),
'_um_register_secondary_btn' => 1,
'_um_register_secondary_btn_word' => __( 'Login', 'ultimate-member' ),
'_um_register_secondary_btn_url' => '',
/*Login Form*/
'_um_login_template' => 'login',
'_um_login_max_width' => '450px',
'_um_login_align' => 'center',
'_um_login_icons' => 'label',
'_um_login_primary_btn_word' => __( 'Login', 'ultimate-member' ),
'_um_login_forgot_pass_link' => 1,
'_um_login_show_rememberme' => 1,
'_um_login_secondary_btn' => 1,
'_um_login_secondary_btn_word' => __( 'Register', 'ultimate-member' ),
'_um_login_secondary_btn_url' => '',
/*Member Directory*/
'_um_directory_template' => 'members',
'_um_directory_header' => __( '{total_users} Members', 'ultimate-member' ),
'_um_directory_header_single' => __( '{total_users} Member', 'ultimate-member' ),
) );
$this->core_form_meta['register'] = array(
@@ -559,7 +566,8 @@ if ( ! class_exists( 'um\Config' ) ) {
'cover_photo_max_size' => 999999999,
'custom_roles_increment' => 1,
'um_profile_object_cache_stop' => 0,
'rest_api_version' => '2.0'
'rest_api_version' => '2.0',
'profile_show_html_bio' => 0,
);
add_filter( 'um_get_tabs_from_config', '__return_true' );
+27
View File
@@ -1442,5 +1442,32 @@ if ( ! class_exists( 'um\core\Files' ) ) {
}
/**
* Get the list of profile/cover sizes
*
* @param string $type
*
* @return array
*/
function get_profile_photo_size( $type ) {
$sizes = UM()->options()->get( $type );
$sizes = array_combine( $sizes, $sizes );
if ( $type == 'cover_thumb_sizes' ) {
foreach ( $sizes as $key => $value ) {
$sizes[ $key ] = $value . 'px';
}
} elseif ( $type == 'photo_thumb_sizes' ) {
foreach ( $sizes as $key => $value ) {
$sizes[ $key ] = $value . 'x' . $value . 'px';
}
}
$sizes['original'] = __( 'Original size', 'ultimate-member' );
return $sizes;
}
}
}
+4 -4
View File
@@ -482,10 +482,10 @@ function um_submit_form_errors_hook_( $args ) {
UM()->form()->add_error($key, sprintf(__('Your %s must contain less than %s characters','ultimate-member'), $array['label'], $array['max_chars']) );
}
}
$profile_show_html_bio = UM()->options()->get('profile_show_html_bio');
if ( $profile_show_html_bio == 1 && $key !== "description" ) {
$profile_show_html_bio = UM()->options()->get( 'profile_show_html_bio' );
if ( $profile_show_html_bio == 1 && $key !== 'description' ) {
if ( isset( $array['html'] ) && $array['html'] == 0 ) {
if ( wp_strip_all_tags( $args[$key] ) != trim( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'You can not use HTML tags here', 'ultimate-member' ) );
+54 -9
View File
@@ -667,16 +667,47 @@ function um_profile_header_cover_area( $args ) {
<?php if ( um_user( 'cover_photo' ) ) {
if ( UM()->mobile()->isMobile() ) {
if ( UM()->mobile()->isTablet() ) {
echo um_user( 'cover_photo', 1000 );
} else {
echo um_user( 'cover_photo', 300 );
}
$get_cover_size = $args['coversize'];
if ( ! $get_cover_size || $get_cover_size == 'original' ) {
$size = null;
} else {
echo um_user( 'cover_photo', 1000 );
$size = $get_cover_size;
}
if ( UM()->mobile()->isMobile() ) {
// set for mobile width = 300 by default but can be changed via filter
if ( ! UM()->mobile()->isTablet() ) {
$size = 300;
}
/**
* UM hook
*
* @type filter
* @title um_mobile_cover_photo
* @description Add size for mobile device
* @input_vars
* [{"var":"$size","type":"int","desc":"Form's agrument - Cover Photo size"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_mobile_cover_photo', 'change_size', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_mobile_cover_photo', 'um_change_cover_mobile_size', 10, 1 );
* function um_change_cover_mobile_size( $size ) {
* // your code here
* return $size;
* }
* ?>
*/
$size = apply_filters( 'um_mobile_cover_photo', $size );
}
echo um_user( 'cover_photo', $size );
} elseif ( $default_cover && $default_cover['url'] ) {
$default_cover = $default_cover['url'];
@@ -782,8 +813,22 @@ function um_profile_header( $args ) {
<div class="um-profile-photo" data-user_id="<?php echo esc_attr( um_profile_id() ); ?>">
<a href="<?php echo esc_url( um_user_profile_url() ); ?>" class="um-profile-photo-img"
title="<?php echo esc_attr( um_user( 'display_name' ) ); ?>"><?php echo $overlay . get_avatar( um_user( 'ID' ), $default_size ); ?></a>
<a href="<?php echo esc_url( um_user_profile_url() ); ?>" class="um-profile-photo-img" title="<?php echo esc_attr( um_user( 'display_name' ) ); ?>">
<?php if ( ! $default_size || $default_size == 'original' ) {
$profile_photo = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/" . um_profile( 'profile_photo' );
$data = um_get_user_avatar_data( um_user( 'ID' ) );
echo $overlay . sprintf( '<img src="%s" class="%s" alt="%s" data-default="%s" onerror="%s" />',
esc_url( $profile_photo ),
esc_attr( $data['class'] ),
esc_attr( $data['alt'] ),
esc_attr( $data['default'] ),
'if ( ! this.getAttribute(\'data-load-error\') ){ this.setAttribute(\'data-load-error\', \'1\');this.setAttribute(\'src\', this.getAttribute(\'data-default\'));}'
);
} else {
echo $overlay . get_avatar( um_user( 'ID' ), $default_size );
} ?>
</a>
<?php if ( empty( $disable_photo_uploader ) && empty( UM()->user()->cannot_edit ) ) {
+5 -5
View File
@@ -1252,7 +1252,7 @@ function um_styling_defaults( $mode ) {
function um_get_metadefault( $id ) {
$core_form_meta_all = UM()->config()->core_form_meta_all;
return isset( $core_form_meta_all['_um_' . $id] ) ? $core_form_meta_all['_um_' . $id] : '';
return isset( $core_form_meta_all[ '_um_' . $id ] ) ? $core_form_meta_all[ '_um_' . $id ] : '';
}
@@ -1998,10 +1998,10 @@ function um_get_user_avatar_data( $user_id = '', $size = '96' ) {
}
$data = array(
'user_id' => $user_id,
'default' => um_get_default_avatar_uri(),
'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
'size' => $size
'user_id' => $user_id,
'default' => um_get_default_avatar_uri(),
'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
'size' => $size
);
if ( $profile_photo = um_profile( 'profile_photo' ) ) {
File diff suppressed because it is too large Load Diff
+2
View File
@@ -151,6 +151,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
- Added AJAXed member directories
- Updated member directories' search engine
- Additional parameter 'user_id' to action hook 'um_user_after_updating_profile'
- Added ability to set profile/cover image sizes from Ultimate Member -> General -> Uploads settings or Original size
* Bugfixes:
- Optimized usermeta for Account submit security
@@ -159,6 +160,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
- Fixed country fields values
- Fixed dynamic_profile.php notice
- Fixed integration with WP native admin_post and admin_post_nopriv requests
- Fixed profile image settings
= 2.0.56: August 21, 2019 =