From 682c4929ce1b6ac9f3e63a817135d24621f3ede3 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Tue, 1 Oct 2024 17:06:43 +0300 Subject: [PATCH] * additional fix for #1551; --- includes/core/class-fields.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 872dd5e2..07a4b1d3 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -2118,6 +2118,13 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @return array */ public function get_restricted_fields_for_edit( $_um_profile_id = false ) { + static $cache = array(); + + $cache_key = absint( $_um_profile_id ); + if ( array_key_exists( $cache_key, $cache ) ) { + return $cache[ $cache_key ]; + } + // fields that need to be disabled in edit mode (profile) $arr_restricted_fields = array( 'user_email', 'username', 'user_login', 'user_password', '_um_last_login', 'user_registered' ); /** @@ -2140,7 +2147,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * } * add_filter( 'um_user_profile_restricted_edit_fields', 'my_make_email_editable', 10, 2 ); */ - return apply_filters( 'um_user_profile_restricted_edit_fields', $arr_restricted_fields, $_um_profile_id ); + $cache[ $cache_key ] = apply_filters( 'um_user_profile_restricted_edit_fields', $arr_restricted_fields, $_um_profile_id ); + + return $cache[ $cache_key ]; } /**