From a08762316e30214732b625bc88a6ad9b75dba202 Mon Sep 17 00:00:00 2001 From: Nikita Sinelnikov Date: Wed, 28 Jul 2021 13:23:57 +0300 Subject: [PATCH] - fixed login form arguments; - added static cache; --- includes/core/class-access.php | 11 ++++++++++- includes/core/um-actions-login.php | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/core/class-access.php b/includes/core/class-access.php index 36e904ca..27f210b0 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -179,6 +179,12 @@ if ( ! class_exists( 'um\core\Access' ) ) { function get_comment_count( $post_id = 0, $exclude_posts = array() ) { + static $cache = array(); + + if ( isset( $cache[ $post_id ] ) ) { + return $cache[ $post_id ]; + } + global $wpdb; $post_id = (int) $post_id; @@ -240,7 +246,10 @@ if ( ! class_exists( 'um\core\Access' ) ) { } } - return array_map( 'intval', $comment_count ); + $comment_count = array_map( 'intval', $comment_count ); + $cache[ $post_id ] = $comment_count; + + return $comment_count; } diff --git a/includes/core/um-actions-login.php b/includes/core/um-actions-login.php index 8732fde2..35c2203c 100644 --- a/includes/core/um-actions-login.php +++ b/includes/core/um-actions-login.php @@ -413,7 +413,7 @@ function um_add_submit_button_to_login( $args ) {
- fields()->checkbox( 'rememberme', __( 'Keep me signed in', 'ultimate-member' ), false ); ?>