From b60f2aced31d79093c11fb39523abd6fa44ce08e Mon Sep 17 00:00:00 2001 From: ashubawork Date: Fri, 7 Apr 2023 09:51:31 +0300 Subject: [PATCH 01/14] - add settings tab --- includes/admin/core/class-admin-settings.php | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 176b29ba..e452c81a 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -64,6 +64,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 ); + //custom content for licenses tab + add_filter( 'um_settings_section_override_templates__content', array( $this, 'settings_override_templates_tab' ), 10, 2 ); + add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 ); @@ -1839,6 +1842,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), ), + 'override_templates' => array( + 'title' => __( 'Override templates', 'ultimate-member' ), + 'fields' => array( + array( + 'type' => 'override_templates', + ), + ), + ), ) ); @@ -3008,6 +3019,21 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } + public function settings_override_templates_tab( $html, $section_fields ) { + ob_start(); + ?> +

+ + + +

+ Date: Fri, 7 Apr 2023 11:33:22 +0300 Subject: [PATCH 02/14] - basic list of override templates --- includes/admin/core/class-admin-settings.php | 99 ++++++++++++++++++++ templates/message.php | 9 +- templates/profile.php | 6 +- templates/searchform.php | 8 +- 4 files changed, 117 insertions(+), 5 deletions(-) diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index e452c81a..c448377c 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -3020,6 +3020,46 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { public function settings_override_templates_tab( $html, $section_fields ) { + $outdated_files = array(); + $scan_files = $this->scan_template_files( um_path . '/templates/' ); + foreach ( $scan_files as $key => $file ) { + if ( ! str_contains( $file, 'email/' ) ) { + $located = apply_filters( 'um_located_template', $file, get_stylesheet_directory() . '/ultimate-member/' ); + if ( file_exists( $located ) ) { + $theme_file = $located; + } elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { + $theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file; + } else { + $theme_file = false; + } + if ( ! empty( $theme_file ) ) { + $core_file = $file; + + $core_version = $this->get_file_version( um_path . '/templates/' . $core_file ); + $theme_version = $this->get_file_version( $theme_file ); + + $status = esc_html__( 'Theme version up to date', 'ultimate-member' ); + $status_code = 1; + if ( version_compare( $theme_version, $core_version, '<' ) ) { + $status = esc_html__( 'Theme version is out of date', 'ultimate-member' ); + $status_code = 0; + } + if ( '' === $theme_version ) { + $status = esc_html__( 'Theme version is empty', 'ultimate-member' ); + $status_code = 0; + } + $outdated_files[] = array( + 'core_version' => $core_version, + 'theme_version' => $theme_version, + 'core_file' => stristr( um_path . 'templates/' . $core_file, 'wp-content' ), + 'theme_file' => stristr( $theme_file, 'wp-content' ), + 'status' => $status, + 'status_code' => $status_code, + ); + } + } + } + ob_start(); ?>

@@ -3034,6 +3074,65 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } + /** + * Scan the template files. + * + * @param string $template_path Path to the template directory. + * @return array + */ + public static function scan_template_files( $template_path ) { + $files = @scandir( $template_path ); // @codingStandardsIgnoreLine. + $result = array(); + + if ( ! empty( $files ) ) { + + foreach ( $files as $key => $value ) { + + if ( ! in_array( $value, array( '.', '..' ), true ) ) { + + if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { + $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); + foreach ( $sub_files as $sub_file ) { + $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; + } + } else { + $result[] = $value; + } + } + } + } + return $result; + } + + + public static function get_file_version( $file ) { + + // Avoid notices if file does not exist. + if ( ! file_exists( $file ) ) { + return ''; + } + + // We don't need to write to the file, so just open for reading. + $fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine. + + // Pull only the first 8kiB of the file in. + $file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine. + + // PHP will close file handle, but we are good citizens. + fclose( $fp ); // @codingStandardsIgnoreLine. + + // Make sure we catch CR-only line endings. + $file_data = str_replace( "\r", "\n", $file_data ); + $version = ''; + + if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) { + $version = _cleanup_header_comment( $match[1] ); + } + + return $version; + } + + /** * @param $html * @param $section_fields diff --git a/templates/message.php b/templates/message.php index 58572f36..b2d6c5d4 100644 --- a/templates/message.php +++ b/templates/message.php @@ -1,4 +1,9 @@ - +

@@ -8,4 +13,4 @@ printf( __( '%s', 'ultimate-member' ), $this->custom_message ); ?>
- \ No newline at end of file + diff --git a/templates/profile.php b/templates/profile.php index 7ca2fb9e..6c85989c 100644 --- a/templates/profile.php +++ b/templates/profile.php @@ -1,4 +1,8 @@ - +
diff --git a/templates/searchform.php b/templates/searchform.php index 7761c452..0e08d9a7 100644 --- a/templates/searchform.php +++ b/templates/searchform.php @@ -1,4 +1,8 @@ - +
@@ -9,4 +13,4 @@
-
\ No newline at end of file + From 00dd3d6b9fbce758ffb6d21edd1b3079fd2d074d Mon Sep 17 00:00:00 2001 From: ashubawork Date: Fri, 7 Apr 2023 12:45:34 +0300 Subject: [PATCH 03/14] - list of templates --- .../admin/assets/css/um-admin-settings.css | 16 +- includes/admin/core/class-admin-settings.php | 29 +- .../version-template-list-table.php | 322 ++++++++++++++++++ 3 files changed, 351 insertions(+), 16 deletions(-) create mode 100644 includes/admin/core/list-tables/version-template-list-table.php diff --git a/includes/admin/assets/css/um-admin-settings.css b/includes/admin/assets/css/um-admin-settings.css index 0f8d78df..1e159673 100644 --- a/includes/admin/assets/css/um-admin-settings.css +++ b/includes/admin/assets/css/um-admin-settings.css @@ -46,6 +46,20 @@ text-align: center; } +.column-core_version { + width: 100px; + text-align: center; +} + +.column-theme_version { + width: 100px; + text-align: center; +} + +.column-status { + width: 260px; +} + th.column-email.column-primary { padding-left: 48px; } @@ -243,4 +257,4 @@ th.column-email.column-primary { .um_setting_ajax_button_response.complete { color:darkgreen; font-style: italic; -} \ No newline at end of file +} diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index c448377c..441bdbcd 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -3020,14 +3020,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { public function settings_override_templates_tab( $html, $section_fields ) { + ?> +

+ + + +

+ scan_template_files( um_path . '/templates/' ); foreach ( $scan_files as $key => $file ) { if ( ! str_contains( $file, 'email/' ) ) { - $located = apply_filters( 'um_located_template', $file, get_stylesheet_directory() . '/ultimate-member/' ); - if ( file_exists( $located ) ) { - $theme_file = $located; - } elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { + if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { $theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file; } else { $theme_file = false; @@ -3060,17 +3069,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } - ob_start(); - ?> -

- - - -

- __( 'item', 'ultimate-member' ), + 'plural' => __( 'items', 'ultimate-member' ), + 'ajax' => false, + ) + ); + + $this->no_items_message = $args['plural'] . ' ' . __( 'not found.', 'ultimate-member' ); + + parent::__construct( $args ); + } + + + /** + * @param callable $name + * @param array $arguments + * + * @return mixed + */ + public function __call( $name, $arguments ) { + return call_user_func_array( array( $this, $name ), $arguments ); + } + + + /** + * + */ + public function prepare_items() { + $columns = $this->get_columns(); + $hidden = array(); + $sortable = $this->get_sortable_columns(); + $this->_column_headers = array( $columns, $hidden, $sortable ); + } + + + /** + * @param object $item + * @param string $column_name + * + * @return string + */ + public function column_default( $item, $column_name ) { + if ( isset( $item[ $column_name ] ) ) { + return $item[ $column_name ]; + } else { + return ''; + } + } + + + /** + * + */ + public function no_items() { + echo $this->no_items_message; + } + + + /** + * @param array $args + * + * @return $this + */ + public function set_sortable_columns( $args = array() ) { + $return_args = array(); + foreach ( $args as $k=>$val ) { + if ( is_numeric( $k ) ) { + $return_args[ $val ] = array( $val, $val == $this->default_sorting_field ); + } elseif( is_string( $k ) ) { + $return_args[ $k ] = array( $val, $k == $this->default_sorting_field ); + } else { + continue; + } + } + $this->sortable_columns = $return_args; + return $this; + } + + + /** + * @return array + */ + public function get_sortable_columns() { + return $this->sortable_columns; + } + + + /** + * @param array $args + * + * @return $this + */ + public function set_columns( $args = array() ) { + if ( count( $this->bulk_actions ) ) { + $args = array_merge( array( 'cb' => '' ), $args ); + } + $this->columns = $args; + + return $this; + } + + + /** + * @return array + */ + public function get_columns() { + return $this->columns; + } + + + /** + * @param array $args + * + * @return $this + */ + public function set_actions( $args = array() ) { + $this->actions = $args; + return $this; + } + + + /** + * @return array + */ + public function get_actions() { + return $this->actions; + } + + + /** + * @param array $args + * + * @return $this + */ + public function set_bulk_actions( $args = array() ) { + $this->bulk_actions = $args; + return $this; + } + + + /** + * @return array + */ + public function get_bulk_actions() { + return $this->bulk_actions; + } + + + /** + * @param $item + * + * @return string + */ + public function column_template( $item ) { + $output = esc_html__( 'Core path - ', 'ultimate-member' ); + $output .= $item['core_file'] . '
'; + $output .= esc_html__( 'Theme path - ', 'ultimate-member' ); + $output .= $item['theme_file']; + + return $output; + } + + + /** + * @param $item + * + * @return string + */ + public function column_core_version( $item ) { + return $item['core_version']; + } + + + /** + * @param $item + * + * @return string + */ + public function column_theme_version( $item ) { + $theme_version = $item['theme_version'] ? $item['theme_version'] : '-'; + + return $theme_version; + } + + + /** + * @param $item + * + * @return string + */ + public function column_status( $item ) { + $icon = 1 === $item['status_code'] ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt'; + $text = $item['status'] . ' '; + + return $text; + } + + + /** + * @param array $attr + */ + public function wpc_set_pagination_args( $attr = array() ) { + $this->set_pagination_args( $attr ); + } +} + +$ListTable = new UM_Versions_List_Table( + array( + 'singular' => __( 'Template', 'ultimate-member' ), + 'plural' => __( 'Templates', 'ultimate-member' ), + 'ajax' => false, + ) +); + +$per_page = 999; +$paged = $ListTable->get_pagenum(); + +/** + * UM hook + * + * @type filter + * @title um_versions_templates_columns + * @description Version Templates List Table columns + * @input_vars + * [{"var":"$columns","type":"array","desc":"Columns"}] + * @change_log + * ["Since: 2.0"] + * @usage add_filter( 'um_versions_templates_columns', 'function_name', 10, 1 ); + * @example + * + */ +$columns = apply_filters( + 'um_versions_templates_columns', + array( + 'template' => __( 'Template', 'ultimate-member' ), + 'core_version' => __( 'Core version', 'ultimate-member' ), + 'theme_version' => __( 'Theme version', 'ultimate-member' ), + 'status' => __( 'Status', 'ultimate-member' ), + ) +); + +$ListTable->set_columns( $columns ); + +$templates = UM()->admin_settings()->get_override_templates(); + +$ListTable->prepare_items(); +$ListTable->items = array_slice( $templates, ( $paged - 1 ) * $per_page, $per_page ); +$ListTable->wpc_set_pagination_args( + array( + 'total_items' => count( $templates ), + 'per_page' => $per_page, + ) +); ?> + +
+ + + + display(); ?> +
From 42337c440ac1f71a53c53b5eaac6bc2e5aca0b89 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Mon, 10 Apr 2023 17:46:25 +0300 Subject: [PATCH 04/14] - check versions, add transient --- includes/admin/class-admin.php | 28 ++++++++++++ includes/admin/core/class-admin-notices.php | 27 +++++++++++ includes/admin/core/class-admin-settings.php | 45 ++++++++++++++++--- .../version-template-list-table.php | 2 +- 4 files changed, 96 insertions(+), 6 deletions(-) diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index c6cf0c80..626d35d4 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -80,6 +80,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { add_action( 'um_admin_do_action__um_can_register_notice', array( &$this, 'um_hide_notice' ) ); add_action( 'um_admin_do_action__um_hide_exif_notice', array( &$this, 'um_hide_notice' ) ); add_action( 'um_admin_do_action__user_action', array( &$this, 'user_action' ) ); + add_action( 'um_admin_do_action__check_version', array( &$this, 'check_version' ) ); add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) ); @@ -1869,6 +1870,33 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { } + public function check_version( $action ) { + $templates = UM()->admin_settings()->get_override_templates( true ); + $out_date = false; + + foreach ( $templates as $template ) { + if ( 0 === $template['status_code'] ) { + $out_date = true; + break; + } + } + + if ( false === $out_date ) { + delete_option( 'um_template_version' ); + } + + $url = add_query_arg( + array( + 'page' => 'um_options', + 'tab' => 'override_templates', + ), + admin_url( 'admin.php' ) + ); + wp_safe_redirect( $url ); + exit; + } + + /** * Add any custom links to plugin page * diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 7b335fc5..34745cd8 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -52,6 +52,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $this->extensions_page(); + $this->template_version(); + // removed for now to avoid the bad reviews //$this->reviews_notice(); @@ -714,6 +716,31 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { } + public function template_version() { + if ( true === (bool) get_option( 'um_template_version' ) ) { + $link = get_admin_url( null, 'admin.php?page=um_options&tab=override_templates' ); + ob_start(); + ?> + +

+ override templates status page and update templates', 'ultimate-member' ), $link ); ?> +

+ + admin()->notices()->add_notice( + 'um_private_content_notice', + array( + 'class' => 'error', + 'message' => $message, + 'dismissible' => false, + ), + 10 + ); + } + } + + function dismiss_notice() { UM()->admin()->check_ajax_nonce(); diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 441bdbcd..e72982e2 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -64,7 +64,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 ); - //custom content for licenses tab + //custom content for override templates tab + add_action( 'plugins_loaded', array( $this, 'um_check_template_version' ), 10 ); add_filter( 'um_settings_section_override_templates__content', array( $this, 'settings_override_templates_tab' ), 10, 2 ); @@ -3019,11 +3020,34 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } + public function um_check_template_version() { + $um_check_version = get_transient( 'um_check_template_versions' ); + if ( false === $um_check_version ) { + $this->get_override_templates(); + } + } + + public function settings_override_templates_tab( $html, $section_fields ) { + $um_check_version = get_transient( 'um_check_template_versions' ); ?> +

+ '; + echo esc_html__('You could re-checked changes manually', 'ultimate-member'); + } + ?> +

- + + +

+

+ +

scan_template_files( um_path . '/templates/' ); + $out_date = false; + set_transient( 'um_check_template_versions', current_time('d/m/Y H:i' ), 12 * HOUR_IN_SECONDS ); foreach ( $scan_files as $key => $file ) { if ( ! str_contains( $file, 'email/' ) ) { if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { @@ -3057,6 +3083,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $status = esc_html__( 'Theme version is empty', 'ultimate-member' ); $status_code = 0; } + if ( 0 === $status_code ) { + $out_date = true; + update_option( 'um_template_version', 1 ); + } $outdated_files[] = array( 'core_version' => $core_version, 'theme_version' => $theme_version, @@ -3068,8 +3098,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } } } - - return $outdated_files; + if ( false === $out_date ) { + delete_option( 'um_template_version' ); + } + update_option( 'um_template_statuses', $outdated_files ); + if ( true === $get_list ) { + return $outdated_files; + } } diff --git a/includes/admin/core/list-tables/version-template-list-table.php b/includes/admin/core/list-tables/version-template-list-table.php index 1eb41c65..dda0f3e8 100644 --- a/includes/admin/core/list-tables/version-template-list-table.php +++ b/includes/admin/core/list-tables/version-template-list-table.php @@ -303,7 +303,7 @@ $columns = apply_filters( $ListTable->set_columns( $columns ); -$templates = UM()->admin_settings()->get_override_templates(); +$templates = get_option( 'um_template_statuses' ) ? get_option( 'um_template_statuses' ) : array(); $ListTable->prepare_items(); $ListTable->items = array_slice( $templates, ( $paged - 1 ) * $per_page, $per_page ); From 879290aa908c1de45da189799326287cc83e95c6 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 11 Apr 2023 09:13:36 +0300 Subject: [PATCH 05/14] - add templates versions --- templates/account.php | 22 +++++++++++++--------- templates/gdpr-register.php | 8 ++++++-- templates/login-to-view.php | 8 ++++++-- templates/login.php | 8 ++++++-- templates/logout.php | 18 +++++++++++------- templates/members-grid.php | 6 +++++- templates/members-header.php | 8 ++++++-- templates/members-list.php | 6 +++++- templates/members-pagination.php | 8 ++++++-- templates/members.php | 6 +++++- templates/message.php | 3 +-- templates/modal/um_upload_single.php | 8 ++++++-- templates/modal/um_view_photo.php | 8 ++++++-- templates/password-change.php | 6 +++++- templates/password-reset.php | 6 +++++- templates/profile.php | 2 +- templates/profile/comments-single.php | 8 ++++++-- templates/profile/comments.php | 8 ++++++-- templates/profile/posts-single.php | 6 +++++- templates/profile/posts.php | 8 ++++++-- templates/register.php | 10 +++++++--- templates/restricted-blog.php | 3 +++ templates/restricted-taxonomy.php | 8 ++++++-- templates/searchform.php | 2 +- 24 files changed, 133 insertions(+), 51 deletions(-) diff --git a/templates/account.php b/templates/account.php index 143dc14d..f252d580 100644 --- a/templates/account.php +++ b/templates/account.php @@ -1,11 +1,15 @@ - +
- +
- +
- + \ No newline at end of file +
diff --git a/templates/gdpr-register.php b/templates/gdpr-register.php index 2b175fe1..11248b6b 100644 --- a/templates/gdpr-register.php +++ b/templates/gdpr-register.php @@ -1,4 +1,8 @@ - +
@@ -48,4 +52,4 @@
- \ No newline at end of file + diff --git a/templates/login-to-view.php b/templates/login-to-view.php index 432f1b82..ad253dad 100644 --- a/templates/login-to-view.php +++ b/templates/login-to-view.php @@ -1,7 +1,11 @@ - +
-
\ No newline at end of file + diff --git a/templates/login.php b/templates/login.php index a72c1620..a03f9e78 100644 --- a/templates/login.php +++ b/templates/login.php @@ -1,4 +1,8 @@ - +
@@ -137,4 +141,4 @@
- \ No newline at end of file + diff --git a/templates/logout.php b/templates/logout.php index 6239943f..f51bb105 100644 --- a/templates/logout.php +++ b/templates/logout.php @@ -1,4 +1,8 @@ - +
@@ -11,9 +15,9 @@
- +
- + */ do_action( 'um_logout_after_user_welcome', $args ); ?> - + - +
    - + */ do_action( 'um_logout_user_links', $args ); ?> - +
diff --git a/templates/members-grid.php b/templates/members-grid.php index 125e1564..8f55be79 100644 --- a/templates/members-grid.php +++ b/templates/members-grid.php @@ -1,4 +1,8 @@ - diff --git a/templates/members-header.php b/templates/members-header.php index a7b186ea..8e5506cb 100644 --- a/templates/members-header.php +++ b/templates/members-header.php @@ -1,4 +1,8 @@ - + \ No newline at end of file + diff --git a/templates/members-list.php b/templates/members-list.php index 09ab2d75..67541620 100644 --- a/templates/members-list.php +++ b/templates/members-list.php @@ -1,4 +1,8 @@ - diff --git a/templates/members-pagination.php b/templates/members-pagination.php index b719824c..217feebc 100644 --- a/templates/members-pagination.php +++ b/templates/members-pagination.php @@ -1,4 +1,8 @@ - + \ No newline at end of file + diff --git a/templates/members.php b/templates/members.php index 3a215ade..f1bdb161 100644 --- a/templates/members.php +++ b/templates/members.php @@ -1,4 +1,8 @@ -
diff --git a/templates/modal/um_upload_single.php b/templates/modal/um_upload_single.php index 5fe2bc35..8692c1e0 100644 --- a/templates/modal/um_upload_single.php +++ b/templates/modal/um_upload_single.php @@ -1,3 +1,7 @@ - + - \ No newline at end of file + diff --git a/templates/modal/um_view_photo.php b/templates/modal/um_view_photo.php index d24dbc23..ee373df1 100644 --- a/templates/modal/um_view_photo.php +++ b/templates/modal/um_view_photo.php @@ -1,4 +1,8 @@ - + -
\ No newline at end of file + diff --git a/templates/password-change.php b/templates/password-change.php index 414cb6e0..90e85034 100644 --- a/templates/password-change.php +++ b/templates/password-change.php @@ -1,4 +1,8 @@ - +
diff --git a/templates/password-reset.php b/templates/password-reset.php index 9b706317..62d222cb 100644 --- a/templates/password-reset.php +++ b/templates/password-reset.php @@ -1,4 +1,8 @@ - diff --git a/templates/profile.php b/templates/profile.php index 6c85989c..333359bd 100644 --- a/templates/profile.php +++ b/templates/profile.php @@ -1,6 +1,6 @@ diff --git a/templates/profile/comments-single.php b/templates/profile/comments-single.php index a2b0a395..31bf1ef5 100644 --- a/templates/profile/comments-single.php +++ b/templates/profile/comments-single.php @@ -1,4 +1,8 @@ -comment_post_ID ), $comment ); $link = apply_filters( 'um_user_profile_comment_url', get_permalink( $comment->comment_post_ID ), $comment ); ?> @@ -13,4 +17,4 @@ $link = apply_filters( 'um_user_profile_comment_url', get_permalink( $comment->c
%2$s','ultimate-member' ), $link, $comment_title ); ?>
-
\ No newline at end of file + diff --git a/templates/profile/comments.php b/templates/profile/comments.php index 4b8b3aaa..d73d5366 100644 --- a/templates/profile/comments.php +++ b/templates/profile/comments.php @@ -1,4 +1,8 @@ - +
-
\ No newline at end of file + diff --git a/templates/restricted-blog.php b/templates/restricted-blog.php index 5f682323..afa1c9b4 100644 --- a/templates/restricted-blog.php +++ b/templates/restricted-blog.php @@ -1,4 +1,7 @@ @@ -51,4 +55,4 @@ get_header(); ?> - From 871c0412b4918087fd392a974c984d7e530c0485 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Tue, 11 Apr 2023 16:25:25 +0300 Subject: [PATCH 06/14] - add comments to templates --- includes/admin/class-admin.php | 5 +++++ includes/admin/core/class-admin-notices.php | 8 +++++++- includes/admin/core/class-admin-settings.php | 18 ++++++++++++++++- templates/account.php | 14 ++++++++++++- templates/gdpr-register.php | 10 ++++++++++ templates/login-to-view.php | 12 ++++++++++- templates/login.php | 14 ++++++++++++- templates/logout.php | 14 ++++++++++++- templates/members-grid.php | 21 +++++++++++++++++++- templates/members-header.php | 10 +++++++++- templates/members-list.php | 17 ++++++++++++++++ templates/members-pagination.php | 10 +++++++++- templates/members.php | 12 ++++++++++- templates/message.php | 13 +++++++++++- templates/modal/um_upload_single.php | 8 +++++++- templates/modal/um_view_photo.php | 8 +++++++- templates/password-change.php | 15 +++++++++++++- templates/password-reset.php | 10 ++++++++++ templates/profile.php | 14 ++++++++++++- templates/profile/comments-single.php | 12 ++++++++++- templates/profile/comments.php | 14 ++++++++++++- templates/profile/posts-single.php | 12 ++++++++++- templates/profile/posts.php | 13 +++++++++++- templates/register.php | 14 ++++++++++++- templates/restricted-blog.php | 6 ++++++ templates/restricted-taxonomy.php | 10 +++++++++- templates/searchform.php | 14 ++++++++++++- ultimate-member.php | 2 +- 28 files changed, 307 insertions(+), 23 deletions(-) diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 626d35d4..5db21566 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -1870,6 +1870,11 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { } + /** + * Manual check templates versions + * + * @param $action + */ public function check_version( $action ) { $templates = UM()->admin_settings()->get_override_templates( true ); $out_date = false; diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 34745cd8..dd4277d3 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -716,6 +716,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { } + /** + * Check Templates Versions notice + */ public function template_version() { if ( true === (bool) get_option( 'um_template_version' ) ) { $link = get_admin_url( null, 'admin.php?page=um_options&tab=override_templates' ); @@ -723,7 +726,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { ?>

- override templates status page and update templates', 'ultimate-member' ), $link ); ?> + override templates status page and update templates', 'ultimate-member' ), $link ), UM()->get_allowed_html( 'admin_notice' ) ); + ?>

@@ -3055,11 +3061,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } + /** + * @param $get_list boolean + * + * @return array + */ public function get_override_templates( $get_list = false ) { $outdated_files = array(); $scan_files = $this->scan_template_files( um_path . '/templates/' ); $out_date = false; - set_transient( 'um_check_template_versions', current_time('d/m/Y H:i' ), 12 * HOUR_IN_SECONDS ); + set_transient( 'um_check_template_versions', current_time( 'd/m/Y H:i' ), 12 * HOUR_IN_SECONDS ); foreach ( $scan_files as $key => $file ) { if ( ! str_contains( $file, 'email/' ) ) { if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { @@ -3139,6 +3150,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { } + /** + * @param $file string + * + * @return string + */ public static function get_file_version( $file ) { // Avoid notices if file does not exist. diff --git a/templates/account.php b/templates/account.php index f252d580..48e77697 100644 --- a/templates/account.php +++ b/templates/account.php @@ -1,8 +1,20 @@ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>
diff --git a/templates/gdpr-register.php b/templates/gdpr-register.php index 11248b6b..aab7f89e 100644 --- a/templates/gdpr-register.php +++ b/templates/gdpr-register.php @@ -1,6 +1,16 @@ diff --git a/templates/login-to-view.php b/templates/login-to-view.php index ad253dad..2d335469 100644 --- a/templates/login-to-view.php +++ b/templates/login-to-view.php @@ -1,8 +1,18 @@ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>
diff --git a/templates/login.php b/templates/login.php index a03f9e78..74d6a293 100644 --- a/templates/login.php +++ b/templates/login.php @@ -1,8 +1,20 @@ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>
diff --git a/templates/logout.php b/templates/logout.php index f51bb105..df1eda6a 100644 --- a/templates/logout.php +++ b/templates/logout.php @@ -1,8 +1,20 @@ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>
diff --git a/templates/members-grid.php b/templates/members-grid.php index 8f55be79..f2eb27e3 100644 --- a/templates/members-grid.php +++ b/templates/members-grid.php @@ -1,8 +1,27 @@ diff --git a/templates/members-header.php b/templates/members-header.php index 8e5506cb..e83c40f1 100644 --- a/templates/members-header.php +++ b/templates/members-header.php @@ -1,8 +1,16 @@ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>