diff --git a/assets/css/um-fileupload.css b/assets/css/um-fileupload.css index 1437fb01..deb61b5b 100644 --- a/assets/css/um-fileupload.css +++ b/assets/css/um-fileupload.css @@ -8,7 +8,7 @@ } .um .um-single-image-preview > img { - max-height: 200px; + max-height: 300px; display: block; overflow: hidden; margin: auto; @@ -22,6 +22,9 @@ position: relative; } +.um-single-image-preview.show, +.um-single-file-preview.show {display: block} + .um-single-image-preview > img { max-width: 100%; max-height: inherit; @@ -47,8 +50,14 @@ font-size: 16px; color: #888; position: relative; - top: 4px; + display: block; + width: 100%; + height: 100%; + line-height: 30px; + overflow: hidden; } +.um-single-image-preview a.cancel i:before, +.um-single-file-preview a.cancel i:before{line-height:inherit} /* - file info @@ -60,7 +69,7 @@ } .um-single-fileinfo span.icon { - font-size: 42px; + font-size: 40px; display: inline-block; width: 100px; height: 70px; @@ -68,13 +77,19 @@ background-color: #666; color: #fff !important; } -.um-single-fileinfo span.icon i{vertical-align: middle} +.um-single-fileinfo span.icon i { + display: block; + height: 70px; + line-height: 70px; + overflow: hidden; +} +.um-single-fileinfo span.icon i:before{line-height:inherit} .um-single-fileinfo span.filename { display: block; font-size: 16px; color: #888; - padding: 15px 0 0 0; + padding-top: 5px; } .um-single-fileinfo a { diff --git a/assets/css/um-profile.css b/assets/css/um-profile.css index fd3f40d2..b0d1a7d6 100644 --- a/assets/css/um-profile.css +++ b/assets/css/um-profile.css @@ -19,7 +19,7 @@ display: none; } -.um-profile img {display: block;overflow:hidden;border-radius:0!important;margin: 0!important} +.um-profile img {display: block;overflow:hidden;border-radius:0;margin: 0} .um-profile a, .um-profile a:hover {text-decoration:none !important} @@ -82,7 +82,7 @@ box-sizing: border-box; padding: 0 40px; color: #fff; - text-shadow: 0 2px #333; + text-shadow: 0 1px #666; cursor: pointer !important; line-height: 21px; font-size: 16px; @@ -200,17 +200,17 @@ position: absolute; top: 0; left: 0; - width: 100%; - height: 100%; background: rgba(0,0,0,.5); text-align: center; box-sizing: border-box; padding: 0 40px; color: #fff; + text-shadow: 0 1px #666; + cursor: pointer !important; line-height: 21px; font-size: 16px; - text-shadow: 0 1px #333; - cursor: pointer !important; + height: 100%; + width: 100%; } .um-profile-photo-overlay:hover { diff --git a/assets/css/um-responsive.css b/assets/css/um-responsive.css index 6c28150a..5b18d8c1 100644 --- a/assets/css/um-responsive.css +++ b/assets/css/um-responsive.css @@ -459,7 +459,6 @@ div.uimob800 .um-header .um-profile-meta { padding-left: 200px; } -div.uimob800 .um-cover-overlay span.um-cover-overlay-t, div.uimob800 .um-profile-photo-overlay span.um-profile-photo-overlay-t { display: none !important; diff --git a/assets/css/um-styles.css b/assets/css/um-styles.css index de3a7f66..214b2e53 100644 --- a/assets/css/um-styles.css +++ b/assets/css/um-styles.css @@ -155,6 +155,10 @@ p.um-notice.success { background: #7ACF58; } +p.um-notice.err { + background: #C74A4A; +} + /* - Errors */ @@ -276,19 +280,10 @@ p.um-notice.success { position: absolute; cursor: default; text-align: center !important; - top: 2px; - left: 2px; - width: 50px; - line-height: 34px; -} -.um-field-icon i:before { vertical-align: middle !important; margin: 0 auto !important; } - -.um-field-icon i { - font-size: 20px; - display: inline-block; - width: 100%; - height: 100%; - text-align: center; + top: 5px; + left: 0; + width: 44px; + font-size: 22px; } .um-form input[type=text], @@ -315,7 +310,7 @@ p.um-notice.success { } .um-form input[type=text].um-iconed, -.um-form input[type=password].um-iconed { padding-left: 50px } +.um-form input[type=password].um-iconed { padding-left: 44px } .um-form input[type=text].um-error, .um-form input[type=password].um-error { border-color: #C74A4A !important } @@ -550,4 +545,30 @@ a.um-link-alt:hover {text-decoration: underline !important;} width: 24px; height: 24px; z-index: 2; -} \ No newline at end of file +} + +/* + - Misc. +*/ + +div.um-photo { + margin: 20px auto 0 auto; + text-align: center; +} + +div.um-photo, +div.um-photo a, +div.um-photo img { + border-radius: 3px; +} + +div.um-photo a { + border: 1px solid #e5e5e5; + padding: 5px; + box-sizing: border-box; + display: inline-block; + box-shadow: 0 1px 1px #eee; + margin: 0 auto; +} + +div.um-photo img {max-height: 300px} \ No newline at end of file diff --git a/assets/js/um-modal.js b/assets/js/um-modal.js index 3c01d6b9..61510512 100644 --- a/assets/js/um-modal.js +++ b/assets/js/um-modal.js @@ -1,8 +1,8 @@ function initCrop_UM() { // only when a crop image is in view - var target_img = jQuery('.um-modal:visible .um-single-image-preview.crop img'); - var target_img_parent = jQuery('.um-modal:visible .um-single-image-preview.crop'); + var target_img = jQuery('.um-modal:visible .um-single-image-preview img'); + var target_img_parent = jQuery('.um-modal:visible .um-single-image-preview'); var crop_data = target_img.parent().attr('data-crop'); var min_width = target_img.parent().attr('data-min_width'); @@ -21,10 +21,8 @@ function initCrop_UM() { if ( target_img.attr('src') != '' ) { var max_height = jQuery(window).height() - ( jQuery('.um-modal-footer a').height() + 20 ) - 50 - ( jQuery('.um-modal-header:visible').height() ); - target_img.css({'height' : 'auto'}); target_img_parent.css({'height' : 'auto'}); - if ( jQuery(window).height() <= 400 ) { target_img_parent.css({ 'height': max_height +'px', 'max-height' : max_height + 'px' }); target_img.css({ 'height' : 'auto' }); @@ -32,7 +30,7 @@ function initCrop_UM() { target_img.css({ 'height': 'auto', 'max-height' : max_height + 'px' }); target_img_parent.css({ 'height': target_img.height(), 'max-height' : max_height + 'px' }); } - + if ( crop_data == 'square' ) { var opts = { @@ -63,7 +61,7 @@ function initCrop_UM() { } }; - } else { + } else if ( crop_data == 'user' ) { var opts = { dragCrop: true, @@ -78,7 +76,9 @@ function initCrop_UM() { } - target_img.cropper( opts ); + if ( crop_data != 0 ) { + target_img.cropper( opts ); + } } } @@ -162,7 +162,7 @@ function um_modal_responsive() { function um_remove_modal(){ - jQuery('.um-single-image-preview img').cropper("destroy"); + jQuery('.um-modal .um-single-image-preview img').cropper("destroy"); jQuery('body,html').css("overflow", "auto"); @@ -229,7 +229,7 @@ jQuery(document).ready(function() { var parent = jQuery(this).parents('.um-modal-body'); - parent.find('.um-single-image-preview img').cropper("destroy"); + parent.find('.um-modal .um-single-image-preview img').cropper("destroy"); parent.find('.um-single-image-preview img').attr('src', ''); @@ -258,6 +258,8 @@ jQuery(document).ready(function() { jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( jQuery(this).attr('data-change') ); + jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('input[type=hidden]').val( jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('.um-single-fileinfo a').attr('href') ); + }); /** @@ -317,6 +319,9 @@ jQuery(document).ready(function() { jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', src + "?"+d.getTime()); um_remove_modal(); jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( elem.attr('data-change') ); + + jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('input[type=hidden]').val( src ); + } diff --git a/assets/js/um-responsive.js b/assets/js/um-responsive.js index 3ab010c0..9db34d8f 100644 --- a/assets/js/um-responsive.js +++ b/assets/js/um-responsive.js @@ -146,7 +146,7 @@ jQuery(window).load(function() { /* Run only when window is resized */ jQuery(window).resize(function() { - jQuery('.um-single-image-preview.crop:visible img').cropper("destroy"); + jQuery('.um-modal .um-single-image-preview.crop:visible img').cropper("destroy"); um_responsive(); um_modal_responsive(); diff --git a/assets/js/um-scripts.js b/assets/js/um-scripts.js index be100634..7a279621 100644 --- a/assets/js/um-scripts.js +++ b/assets/js/um-scripts.js @@ -126,6 +126,7 @@ jQuery(document).ready(function() { var parent = jQuery(this).parents('.um-field'); parent.find('.um-single-image-preview').hide(); parent.find('.um-btn-auto-width').html('Upload'); + parent.find('input[type=hidden]').val(''); return false; }); @@ -135,6 +136,7 @@ jQuery(document).ready(function() { var parent = jQuery(this).parents('.um-field'); parent.find('.um-single-file-preview').hide(); parent.find('.um-btn-auto-width').html('Upload'); + parent.find('input[type=hidden]').val(''); return false; }); diff --git a/core/um-actions-form.php b/core/um-actions-form.php index 2e88d857..71cf1179 100644 --- a/core/um-actions-form.php +++ b/core/um-actions-form.php @@ -51,6 +51,8 @@ do_action('um_submit_form_errors_hook_login', $args ); + do_action('um_submit_form_errors_hook_logincheck', $args ); + } else { do_action('um_submit_form_errors_hook_', $args ); diff --git a/core/um-actions-login.php b/core/um-actions-login.php index 07ca5ab4..e0dbb759 100644 --- a/core/um-actions-login.php +++ b/core/um-actions-login.php @@ -62,7 +62,6 @@ switch( $err ) { default: - break; case 'incorrect_password': @@ -78,6 +77,37 @@ } + /*** + *** @login checks + ***/ + add_action('um_submit_form_errors_hook_logincheck', 'um_submit_form_errors_hook_logincheck', 9999 ); + function um_submit_form_errors_hook_logincheck($args){ + global $ultimatemember; + + // Logout if logged in + if ( is_user_logged_in() ) { + wp_logout(); + } + + $user_id = ( isset( $ultimatemember->login->auth_id ) ) ? $ultimatemember->login->auth_id : ''; + um_fetch_user( $user_id ); + + $status = um_user('account_status'); // account status + switch( $status ) { + + // If user can't login to site... + case 'inactive': + case 'awaiting_admin_review': + case 'awaiting_email_confirmation': + case 'rejected': + um_reset_user(); + exit( wp_redirect( add_query_arg( 'err', $status, $ultimatemember->permalinks->get_current_url() ) ) ); + break; + + } + + } + /*** *** @login user ***/ @@ -85,16 +115,8 @@ function um_user_login($args){ global $ultimatemember; extract( $args ); - - if ( is_user_logged_in() ) { - wp_logout(); - } - $user_id = $ultimatemember->login->auth_id; - - um_fetch_user( $user_id ); - - $ultimatemember->user->auto_login( $user_id ); + $ultimatemember->user->auto_login( um_user('ID') ); // Priority redirect if ( isset( $args['redirect_to'] ) ) { diff --git a/core/um-actions-misc.php b/core/um-actions-misc.php index 7d102ad0..518a5c39 100644 --- a/core/um-actions-misc.php +++ b/core/um-actions-misc.php @@ -49,22 +49,37 @@ function um_add_update_notice($args){ global $ultimatemember; extract($args); + $output = ''; + if ( isset( $_REQUEST['updated'] ) && !empty( $_REQUEST['updated'] ) ) { - switch( $_REQUEST['updated'] ) { - case 'password_changed': - $msg = __('You have successfully changed your password.','ultimatemember'); + $success = __('You have successfully changed your password.','ultimatemember'); break; - } - } - if ( isset( $msg ) ) { - - echo '
' . $msg . '
'; - + if ( isset( $_REQUEST['err'] ) && !empty( $_REQUEST['err'] ) ) { + switch( $_REQUEST['err'] ) { + case 'inactive': + $err = __('Your account has been disabled.','ultimatemember'); + break; + case 'awaiting_admin_review': + $err = __('Your account has not been approved yet.','ultimatemember'); + break; + case 'awaiting_email_confirmation': + $err = __('Your account is awaiting e-mail verifications.','ultimatemember'); + break; + case 'rejected': + $err = __('Your membership request has been rejected.','ultimatemember'); + break; + } } + if ( isset( $err ) ) { + $output .= '' . $err . '
'; + } + + echo $output; + } \ No newline at end of file diff --git a/core/um-actions-profile.php b/core/um-actions-profile.php index c5f78c2f..bfe8a4f7 100644 --- a/core/um-actions-profile.php +++ b/core/um-actions-profile.php @@ -261,6 +261,7 @@ global $ultimatemember; $to_update = null; + $files = null; if ( isset( $args['user_id'] ) ) { if ( um_can_edit_profile( $args['user_id'] ) ) { @@ -289,6 +290,11 @@ } else if ( $args['submitted'][$key] ) { $to_update[ $key ] = $args['submitted'][ $key ]; } + + // files + if ( isset( $fields[$key]['type'] ) && in_array( $fields[$key]['type'], array('image','file') ) && um_is_temp_upload( $args['submitted'][ $key ] ) ) { + $files[ $key ] = $args['submitted'][ $key ]; + } } } @@ -296,6 +302,10 @@ if ( is_array( $to_update ) ) { $ultimatemember->user->update_profile( $to_update ); } + + if ( is_array( $files ) ) { + $ultimatemember->user->update_files( $files ); + } do_action('um_user_after_updating_profile', $to_update ); diff --git a/core/um-fields.php b/core/um-fields.php index 93e18b2b..5938e1dd 100644 --- a/core/um-fields.php +++ b/core/um-fields.php @@ -308,6 +308,8 @@ class UM_Fields { function field_value( $key, $default = false, $data = null ) { global $ultimatemember; + $type = (isset($data['type']))?$data['type']:''; + // preview in backend if ( isset( $ultimatemember->user->preview ) && $ultimatemember->user->preview ) { $submitted = um_user('submitted'); @@ -336,6 +338,7 @@ class UM_Fields { $value = um_user( $key ); $value = apply_filters("um_profile_field_filter_hook__", $value, $data ); $value = apply_filters("um_profile_field_filter_hook__{$key}", $value, $data ); + $value = apply_filters("um_profile_field_filter_hook__{$type}", $value, $data ); return $value; @@ -1002,19 +1005,33 @@ class UM_Fields { case 'image': $output .= '