Merge remote-tracking branch 'remotes/origin/feature/directory_exclude_users'

This commit is contained in:
nikitasinelnikov
2020-05-25 17:49:02 +03:00
4 changed files with 46 additions and 0 deletions
@@ -1073,6 +1073,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
delete_post_meta( $post_id, '_um_roles_can_search' );
delete_post_meta( $post_id, '_um_roles_can_filter' );
delete_post_meta( $post_id, '_um_show_these_users' );
delete_post_meta( $post_id, '_um_exclude_these_users' );
delete_post_meta( $post_id, '_um_search_filters' );
delete_post_meta( $post_id, '_um_search_filters_gmt' );
@@ -1084,6 +1085,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
$v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
}
if ( $k == '_um_exclude_these_users' && trim( $_POST['um_metadata'][ $k ] ) ) {
$v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
}
if ( strstr( $k, '_um_' ) ) {
if ( $k === '_um_is_default' ) {
@@ -10,6 +10,11 @@ if ( $show_these_users ) {
$show_these_users = implode( "\n", str_replace( "\r", "", $show_these_users ) );
}
$exclude_these_users = get_post_meta( get_the_ID(), '_um_exclude_these_users', true );
if ( $exclude_these_users ) {
$exclude_these_users = implode( "\n", str_replace( "\r", "", $exclude_these_users ) );
}
$_um_view_types_value = get_post_meta( $post_id, '_um_view_types', true );
$_um_view_types_value = empty( $_um_view_types_value ) ? array( 'grid', 'list' ) : $_um_view_types_value;
@@ -77,6 +82,12 @@ foreach ( $view_types_options as $key => $value ) {
'label' => __( 'Only show specific users (Enter one username per line)', 'ultimate-member' ),
'value' => $show_these_users,
),
array(
'id' => '_um_exclude_these_users',
'type' => 'textarea',
'label' => __( 'Exclude specific users (Enter one username per line)', 'ultimate-member' ),
'value' => $exclude_these_users,
),
);
/**