mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed displaying outdated templates admin notice between theme switching;
This commit is contained in:
@@ -1904,19 +1904,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
* Manual check templates versions.
|
||||
*/
|
||||
public function check_templates_version() {
|
||||
$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_override_templates_outdated' );
|
||||
}
|
||||
UM()->common()->theme()->check_outdated_templates();
|
||||
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
|
||||
@@ -24,6 +24,7 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
$this->screen();
|
||||
$this->secure()->hooks();
|
||||
$this->site_health();
|
||||
$this->theme()->hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,5 +74,17 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
}
|
||||
return UM()->classes['um\common\site_health'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.3
|
||||
*
|
||||
* @return Theme
|
||||
*/
|
||||
public function theme() {
|
||||
if ( empty( UM()->classes['um\common\theme'] ) ) {
|
||||
UM()->classes['um\common\theme'] = new Theme();
|
||||
}
|
||||
return UM()->classes['um\common\theme'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ if ( ! class_exists( 'um\common\Screen' ) ) {
|
||||
* Screen constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000, 1 );
|
||||
add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace um\common;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Theme
|
||||
*
|
||||
* @package um\common
|
||||
*/
|
||||
class Theme {
|
||||
|
||||
public function hooks() {
|
||||
add_action( 'after_switch_theme', array( &$this, 'check_outdated_templates' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find outdated UM templates and notify Administrator.
|
||||
*
|
||||
*/
|
||||
public function check_outdated_templates() {
|
||||
$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_override_templates_outdated' );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user