From 206408e5132cfe3d4ebead1346519d9c9b0bf032 Mon Sep 17 00:00:00 2001 From: champsupertramp Date: Wed, 27 Jan 2016 19:15:47 +0800 Subject: [PATCH] Add option to allow users to hide profiles from member page --- core/um-account.php | 14 ++++++++++++++ um-config.php | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/core/um-account.php b/core/um-account.php index 1e34b95f..2a786194 100644 --- a/core/um-account.php +++ b/core/um-account.php @@ -12,6 +12,8 @@ class UM_Account { add_action('template_redirect', array(&$this, 'form_init'), 10002); + add_filter('um_predefined_fields_hook', array(&$this,'predefined_fields_hook'),1 ); + $this->current_tab = 'general'; } @@ -304,4 +306,16 @@ class UM_Account { $ultimatemember->shortcodes->load_template( $template ); } + /*** + ** @filter account fields + ****/ + function predefined_fields_hook( $predefined_fields ){ + + $account_hide_in_directory = um_get_option('account_hide_in_directory'); + if( ! $account_hide_in_directory ){ + unset( $predefined_fields['hide_in_members'] ); + } + + return $predefined_fields; + } } \ No newline at end of file diff --git a/um-config.php b/um-config.php index c70f2b91..15ebc9bc 100644 --- a/um-config.php +++ b/um-config.php @@ -274,6 +274,16 @@ $this->sections[] = array( 'off' => __('Off','ultimatemember'), ), + array( + 'id' => 'account_hide_in_directory', + 'type' => 'switch', + 'title' => __( 'Allow users to hide their profiles from directory','ultimatemember' ), + 'default' => 1, + 'desc' => __('Whether to allow users changing their profile visibility from member directory in account page.','ultimatemember'), + 'on' => __('On','ultimatemember'), + 'off' => __('Off','ultimatemember'), + ), + array( 'id' => 'account_require_strongpass', 'type' => 'switch',