From 85b6bfdc5fc2b859798a60019ddc2f7002932c51 Mon Sep 17 00:00:00 2001 From: denisbaranov Date: Tue, 15 Dec 2020 19:14:34 +0200 Subject: [PATCH] Fix for the account field "Avoid indexing my profile by search engines" --- includes/core/um-filters-account.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/includes/core/um-filters-account.php b/includes/core/um-filters-account.php index c460102d..7b963c3a 100644 --- a/includes/core/um-filters-account.php +++ b/includes/core/um-filters-account.php @@ -43,4 +43,19 @@ function um_account_sanitize_data( $data ) { return $data; } -add_filter( 'um_account_pre_updating_profile_array', 'um_account_sanitize_data', 10, 1 ); \ No newline at end of file +add_filter( 'um_account_pre_updating_profile_array', 'um_account_sanitize_data', 10, 1 ); + + +/** + * Fix for the account field "Avoid indexing my profile by search engines" + * @since 2.1.14 [2020-12-15] + * @param bool $value + * @return int + */ +function um_account_profile_noindex_value( $value ) { + if ( ! is_numeric( $value ) ) { + $value = (int) get_user_meta( um_profile_id(), 'profile_noindex', true ); + } + return $value; +} +add_filter( 'um_profile_profile_noindex_empty__filter', 'um_account_profile_noindex_value' ); \ No newline at end of file