From b56573dd9be1cc78d4fb8a955c21cd2a43b08e1b Mon Sep 17 00:00:00 2001 From: ashubawork Date: Wed, 12 Jul 2023 09:41:25 +0300 Subject: [PATCH] - checking for account block --- .../admin/assets/css/um-admin-settings.css | 253 +++++++++--------- includes/core/class-account.php | 40 +-- includes/core/class-blocks.php | 9 +- 3 files changed, 159 insertions(+), 143 deletions(-) diff --git a/includes/admin/assets/css/um-admin-settings.css b/includes/admin/assets/css/um-admin-settings.css index 8dab9844..4bcac0c7 100644 --- a/includes/admin/assets/css/um-admin-settings.css +++ b/includes/admin/assets/css/um-admin-settings.css @@ -1,49 +1,52 @@ .um-settings-section .description { - font-style: italic; + font-style: italic; } - - - - - -.um-notification-status { - margin-right: 18px; - font-size: 28px; - line-height: 22px; +.um-block-notice { + background: #fff; + font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif; + font-size:13px; + padding: 20px; + border: 1px solid #000; } .um-notification-status { - color: #a00; - float:left; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; + margin-right: 18px; + font-size: 28px; + line-height: 22px; +} + +.um-notification-status { + color: #a00; + float:left; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; } .um-notification-status.um-notification-is-active { - color: #46b450; + color: #46b450; } .um-email-configure span { - line-height: 24px; + line-height: 24px; } .um-long-field { - width:100%; + width:100%; } .um-medium-field { - width:50%; + width:50%; } .um-small-field { - width:25%; + width:25%; } .column-configure { - width: 60px; - text-align: center; + width: 60px; + text-align: center; } .wp-list-table.templates .column-core_version { @@ -61,47 +64,47 @@ } th.column-email.column-primary { - padding-left: 48px; + padding-left: 48px; } .um-nav-tab-wrapper { - margin-right: 20px; + margin-right: 20px; } #um-settings-emails { - float:left; - width:calc( 100% - 20px ); - margin-right: 20px; + float:left; + width:calc( 100% - 20px ); + margin-right: 20px; } #um-settings-form { - float:left; - width:calc( 100% - 10px ); - margin-right: 10px; + float:left; + width:calc( 100% - 10px ); + margin-right: 10px; } #um-settings-form .subsubsub { - float:left; - width:100%; + float:left; + width:100%; } .um-settings-line .multi-checkbox-line { - float:left; - width:100%; - clear: both; - margin: 0 0 10px 0; - padding: 0; + float:left; + width:100%; + clear: both; + margin: 0 0 10px 0; + padding: 0; } .um-settings-line .multi-checkbox-column { - float:left; - margin: 0; - padding:0; + float:left; + margin: 0; + padding:0; } .um-settings-line .multi-checkbox-column label { - float:left; - width:100%; + float:left; + width:100%; } @@ -113,120 +116,120 @@ th.column-email.column-primary { .wrap-licenses td, .wrap-licenses th, .wrap-licenses caption { - display: block; + display: block; } .wrap-licenses .form-table tr { - float: left; - margin: 0 15px 15px 0; - background: #fff; - border: 1px solid #ccc; - width: 30.5%; - max-width: 350px; - padding: 14px; - min-height: 240px; - position: relative; - box-sizing: border-box; + float: left; + margin: 0 15px 15px 0; + background: #fff; + border: 1px solid #ccc; + width: 30.5%; + max-width: 350px; + padding: 14px; + min-height: 240px; + position: relative; + box-sizing: border-box; } .wrap-licenses .form-table th { - background: #f9f9f9; - padding: 14px; - border-bottom: 1px solid #ccc; - margin: -14px -14px 20px; - width: 100%; + background: #f9f9f9; + padding: 14px; + border-bottom: 1px solid #ccc; + margin: -14px -14px 20px; + width: 100%; } .wrap-licenses .form-table td { - padding: 0; + padding: 0; } .wrap-licenses td input.regular-text { - margin: 0 0 8px; - width: 100%; + margin: 0 0 8px; + width: 100%; } .wrap-licenses .edd-license-data[class*="edd-license-"] { - position: absolute; - background: #fafafa; - padding: 14px; - border-top: 1px solid #eee; - margin: 20px -14px -14px; - min-height: 67px; - width: 100%; - bottom: 14px; - box-sizing: border-box; + position: absolute; + background: #fafafa; + padding: 14px; + border-top: 1px solid #eee; + margin: 20px -14px -14px; + min-height: 67px; + width: 100%; + bottom: 14px; + box-sizing: border-box; } .wrap-licenses .edd-license-data[class*="edd-license-"] a { - color: #444; + color: #444; } .wrap-licenses .edd-license-data[class*="edd-license-"] a:hover { - text-decoration: none; + text-decoration: none; } .wrap-licenses .edd-license-data.license-expires-soon-notice { - background-color: #00a0d2; - color: #fff; - border-color: #00a0d2; + background-color: #00a0d2; + color: #fff; + border-color: #00a0d2; } .wrap-licenses .edd-license-data.edd-license-expired { - background-color: #e24e4e; - color: #fff; - border-color: #e24e4e; + background-color: #e24e4e; + color: #fff; + border-color: #e24e4e; } .wrap-licenses .edd-license-data.edd-license-valid { - background-color: #5abc55; - color: #fff; - border-color: #5abc55; + background-color: #5abc55; + color: #fff; + border-color: #5abc55; } .wrap-licenses .edd-license-data.edd-license-error, .wrap-licenses .edd-license-data.edd-license-missing, .wrap-licenses .edd-license-data.edd-license-invalid, .wrap-licenses .edd-license-data.edd-license-site_inactive, .wrap-licenses .edd-license-data.edd-license-item_name_mismatch { - background-color: #ffebcd; - border-color: #ffebcd; + background-color: #ffebcd; + border-color: #ffebcd; } .wrap-licenses .edd-license-data p { - font-size: 13px; - margin-top: 0; + font-size: 13px; + margin-top: 0; } .wrap-licenses .edd-license-data.license-expires-soon-notice a, .wrap-licenses .edd-license-data.edd-license-expired a { - color: #fff; + color: #fff; } .wrap-licenses .edd-license-data.license-expires-soon-notice a:hover, .wrap-licenses .edd-license-data.edd-license-expired a:hover { - text-decoration: none; + text-decoration: none; } .wrap-licenses ~ p.submit { - clear: both; + clear: both; } @media screen and (max-width: 980px) { - .wrap-licenses .form-table tr { - width:calc( 50% - 15px ); - max-width: none; - } + .wrap-licenses .form-table tr { + width:calc( 50% - 15px ); + max-width: none; + } } @media screen and (max-width: 782px) { - .wrap-licenses .form-table tr { - width:100%; - margin-right: 0; - max-width: none; - } + .wrap-licenses .form-table tr { + width:100%; + margin-right: 0; + max-width: none; + } - .um-settings-line .multi-checkbox-column { - width:100% !important; - } - .um-settings-line .multi-checkbox-column label { - line-height: 30px !important; - } + .um-settings-line .multi-checkbox-column { + width:100% !important; + } + .um-settings-line .multi-checkbox-column label { + line-height: 30px !important; + } - .um-medium-field { - width:100%; - } + .um-medium-field { + width:100%; + } - .um-small-field { - width:50%; - } + .um-small-field { + width:50%; + } .wp-list-table.templates .column-core_version { width: auto; @@ -241,30 +244,30 @@ th.column-email.column-primary { /* .email_template_wrapper .copy_button_overlay { - position:absolute; - top:0; - bottom:0; - width:calc( 100% - 30px ); - z-index: 2; - background: rgba( 241, 241, 241, 0.95 ); - text-align: center; - padding-top: 30%; - padding-right: 20px; - padding-left: 20px; + position:absolute; + top:0; + bottom:0; + width:calc( 100% - 30px ); + z-index: 2; + background: rgba( 241, 241, 241, 0.95 ); + text-align: center; + padding-top: 30%; + padding-right: 20px; + padding-left: 20px; } .email_template_wrapper .copy_button_overlay > span { - color: #444; - margin: 0 0 15px 0; - display: inline-block; + color: #444; + margin: 0 0 15px 0; + display: inline-block; } .email_template_wrapper.in_theme .copy_button_overlay { - display: none !important; + display: none !important; } */ .um_setting_ajax_button_response.complete { - color:darkgreen; - font-style: italic; + color:darkgreen; + font-style: italic; } diff --git a/includes/core/class-account.php b/includes/core/class-account.php index a86b63ef..de307f8d 100644 --- a/includes/core/class-account.php +++ b/includes/core/class-account.php @@ -1,8 +1,9 @@ account_exist ) { + return ''; + } um_fetch_user( get_current_user_id() ); ob_start(); $defaults = array( - 'template' => 'account', - 'mode' => 'account', - 'form_id' => 'um_account_id', + 'template' => 'account', + 'mode' => 'account', + 'form_id' => 'um_account_id', ); - $args = wp_parse_args( $args, $defaults ); + $args = wp_parse_args( $args, $defaults ); /** * UM hook @@ -199,7 +204,7 @@ if ( ! class_exists( 'um\core\Account' ) ) { if ( ! empty( $args['tab'] ) ) { - if ( $args['tab'] == 'account' ) { + if ( 'account' === $args['tab'] ) { $args['tab'] = 'general'; } @@ -233,12 +238,13 @@ if ( ! class_exists( 'um\core\Account' ) ) { */ do_action( 'um_account_page_hidden_fields', $args ); - $this->render_account_tab( $args['tab'], $this->tabs[ $args['tab'] ], $args ); ?> + $this->render_account_tab( $args['tab'], $this->tabs[ $args['tab'] ], $args ); + ?> - init_tabs( $args ); @@ -263,6 +269,8 @@ if ( ! class_exists( 'um\core\Account' ) ) { $this->account_fields_hash(); + $this->account_exist = true; + return $output; } diff --git a/includes/core/class-blocks.php b/includes/core/class-blocks.php index 1c8eb590..cd6b33a3 100644 --- a/includes/core/class-blocks.php +++ b/includes/core/class-blocks.php @@ -206,9 +206,14 @@ if ( ! class_exists( 'um\core\Blocks' ) ) { * @uses apply_shortcodes() */ public function account_render( $atts ) { - if ( um_is_core_page( 'account' ) || um_is_core_page( 'user' ) ) { - return ''; + if ( um_is_core_page( 'user' ) ) { + if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { + return '
' . esc_html__( 'This block cannot be used on this page', 'ultimate-member' ) . '
'; + } else { + return ''; + } } + $shortcode = '[ultimatemember_account is_block="1"'; if ( isset( $atts['tab'] ) && 'all' !== $atts['tab'] ) {