mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- profile tabs privacy;
- fixed issue with added wpautop for UM pages; (remove wpautop)
This commit is contained in:
@@ -137,6 +137,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
|
||||
foreach ( $tabs as $id => $tab ) {
|
||||
|
||||
if ( isset( $tab['hidden'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $tab['default_privacy'] ) ) {
|
||||
$fields = array(
|
||||
array(
|
||||
@@ -181,13 +185,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
$appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, $fields );
|
||||
}
|
||||
|
||||
$active_tabs = array();
|
||||
$tabs = UM()->profile()->tabs_active();
|
||||
if ( ! empty( $tabs ) ) {
|
||||
foreach ( $tabs as $id => $info ) {
|
||||
if ( isset( $info['name'] ) ) {
|
||||
$active_tabs[ $id ] = $info['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, array(
|
||||
array(
|
||||
'id' => 'profile_menu_default_tab',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Profile menu default tab', 'ultimate-member' ),
|
||||
'tooltip' => __( 'This will be the default tab on user profile page', 'ultimate-member' ),
|
||||
'options' => UM()->profile()->tabs_enabled(),
|
||||
'options' => $active_tabs,
|
||||
'conditional' => array( 'profile_menu', '=', 1 ),
|
||||
'size' => 'small'
|
||||
),
|
||||
|
||||
@@ -545,18 +545,18 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
|
||||
$tabs = UM()->profile()->tabs();
|
||||
foreach ( $tabs as $id => $tab ) {
|
||||
$this->settings_defaults['profile_tab_' . $id] = 1;
|
||||
$this->settings_defaults[ 'profile_tab_' . $id ] = 1;
|
||||
|
||||
if ( ! isset( $tab['default_privacy'] ) ) {
|
||||
$this->settings_defaults['profile_tab_' . $id . '_privacy'] = 0;
|
||||
$this->settings_defaults['profile_tab_' . $id . '_roles'] = '';
|
||||
$this->settings_defaults[ 'profile_tab_' . $id . '_privacy' ] = 0;
|
||||
$this->settings_defaults[ 'profile_tab_' . $id . '_roles' ] = '';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $this->email_notifications as $key => $notification ) {
|
||||
$this->settings_defaults[$key . '_on'] = ! empty( $notification['default_active'] );
|
||||
$this->settings_defaults[$key . '_sub'] = $notification['subject'];
|
||||
$this->settings_defaults[$key] = $notification['body'];
|
||||
$this->settings_defaults[ $key . '_on' ] = ! empty( $notification['default_active'] );
|
||||
$this->settings_defaults[ $key . '_sub' ] = $notification['subject'];
|
||||
$this->settings_defaults[ $key ] = $notification['body'];
|
||||
}
|
||||
|
||||
foreach ( $this->core_pages as $page_s => $page ) {
|
||||
|
||||
@@ -77,6 +77,24 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pre-defined privacy options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function tabs_privacy() {
|
||||
$privacy = array(
|
||||
0 => __( 'Anyone', 'ultimate-member' ),
|
||||
1 => __( 'Guests only', 'ultimate-member' ),
|
||||
2 => __( 'Members only', 'ultimate-member' ),
|
||||
3 => __( 'Only the owner', 'ultimate-member' ),
|
||||
4 => __( 'Specific roles', 'ultimate-member' ),
|
||||
);
|
||||
|
||||
return $privacy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* All tab data
|
||||
*
|
||||
@@ -123,7 +141,7 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
// disable private tabs
|
||||
if ( ! is_admin() ) {
|
||||
if ( is_user_logged_in() ) {
|
||||
$user_id = um_user('ID');
|
||||
$user_id = um_user( 'ID' );
|
||||
um_fetch_user( get_current_user_id() );
|
||||
}
|
||||
|
||||
@@ -142,60 +160,6 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tabs that are active
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function tabs_active() {
|
||||
$tabs = $this->tabs();
|
||||
|
||||
foreach ( $tabs as $id => $info ) {
|
||||
if ( ! UM()->options()->get( 'profile_tab_' . $id ) ) {
|
||||
unset( $tabs[ $id ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Activated tabs in backend
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function tabs_enabled() {
|
||||
$tabs = $this->tabs_active();
|
||||
|
||||
foreach ( $tabs as $id => $info ) {
|
||||
if ( isset( $info['name'] ) ) {
|
||||
$primary[ $id ] = $info['name'];
|
||||
}
|
||||
}
|
||||
|
||||
return isset( $primary ) ? $primary : '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Privacy options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function tabs_privacy() {
|
||||
$privacy = array(
|
||||
0 => __( 'Anyone', 'ultimate-member' ),
|
||||
1 => __( 'Guests only', 'ultimate-member' ),
|
||||
2 => __( 'Members only', 'ultimate-member' ),
|
||||
3 => __( 'Only the owner', 'ultimate-member' ),
|
||||
4 => __( 'Specific roles', 'ultimate-member' ),
|
||||
);
|
||||
|
||||
return $privacy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the user can view the current tab
|
||||
*
|
||||
@@ -260,6 +224,28 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tabs that are active
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function tabs_active() {
|
||||
$tabs = $this->tabs();
|
||||
|
||||
foreach ( $tabs as $id => $info ) {
|
||||
if ( ! empty( $info['hidden'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! UM()->options()->get( 'profile_tab_' . $id ) ) {
|
||||
unset( $tabs[ $id ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get active_tab
|
||||
*
|
||||
|
||||
@@ -36,9 +36,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
add_shortcode( 'um_show_content', array( &$this, 'um_shortcode_show_content_for_role' ) );
|
||||
add_shortcode( 'ultimatemember_searchform', array( &$this, 'ultimatemember_searchform' ) );
|
||||
|
||||
|
||||
add_filter( 'body_class', array( &$this, 'body_class' ), 0 );
|
||||
add_action( 'template_redirect', array( &$this, 'is_um_page' ) );
|
||||
|
||||
add_filter( 'um_shortcode_args_filter', array( &$this, 'display_logout_form' ), 99 );
|
||||
add_filter( 'um_shortcode_args_filter', array( &$this, 'parse_shortcode_args' ), 99 );
|
||||
|
||||
Reference in New Issue
Block a user