- profile tabs privacy;

- fixed issue with added wpautop for UM pages; (remove wpautop)
This commit is contained in:
nikitasinelnikov
2019-07-05 16:08:09 +03:00
parent 090588fe88
commit 9015b6c34d
4 changed files with 62 additions and 64 deletions
+41 -55
View File
@@ -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
*