From c894f60010068d0f4f039d6bab6e7bdd58757a83 Mon Sep 17 00:00:00 2001 From: Champ Camba Date: Thu, 9 Feb 2017 20:52:47 +0800 Subject: [PATCH] Refactor securing account fields --- core/um-actions-account.php | 14 +++++++++++++- core/um-filters-account.php | 13 ++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core/um-actions-account.php b/core/um-actions-account.php index ab8a161b..4f8be4bb 100644 --- a/core/um-actions-account.php +++ b/core/um-actions-account.php @@ -20,7 +20,9 @@ } $arr_fields = array(); - $secure_fields = get_user_meta( um_user('ID'), 'um_account_secure_fields', true ); + $account_fields = get_user_meta( um_user('ID'), 'um_account_secure_fields', true ); + $secure_fields = apply_filters('um_secure_account_fields', $account_fields , um_user('ID') ); + if( isset( $secure_fields ) ){ foreach ( $secure_fields as $tab_key => $fields ) { if( isset( $fields ) ){ @@ -30,6 +32,7 @@ } } } + $changes = array(); foreach( $_POST as $k => $v ) { @@ -474,3 +477,12 @@ account->register_fields; + update_user_meta( um_user('ID'), 'um_account_secure_fields', $secure_fields ); + + } diff --git a/core/um-filters-account.php b/core/um-filters-account.php index 1193009a..36c74b07 100644 --- a/core/um-filters-account.php +++ b/core/um-filters-account.php @@ -1,6 +1,5 @@ account->register_fields ) && ! isset( $ultimatemember->account->register_fields[ $tab_key ] ) ){ + $ultimatemember->account->register_fields[ $tab_key ] = $fields; } + + return $fields; } \ No newline at end of file