New feature: show specific users in member directory

This commit is contained in:
Ultimate Member
2015-12-29 17:39:59 +02:00
parent 188229e1bb
commit e3b42da2bf
5 changed files with 41 additions and 4 deletions
+11 -3
View File
@@ -127,8 +127,12 @@ body.um-admin-modal-open {
color: #aaa !important;
}
.um-admin-metabox input[type=text] {
height: auto !important;
}
.um-admin-metabox input[type=text],
.um-admin-metabox textarea{
.um-admin-metabox textarea {
width: 100%;
max-width: 100%;
display: block;
@@ -139,13 +143,17 @@ body.um-admin-modal-open {
outline: none !important;
box-sizing: border-box !important;
box-shadow: none !important;
font-size: 13px !important;
height: auto !important;
line-height: 1.4em !important;
padding: 4px 10px !important;
}
.um-admin-metabox textarea {
padding: 8px !important;
line-height: 1.6em;
color: #888 !important;
}
.um-admin-metabox input[type=text].um-admin-error,
.um-admin-metabox textarea.um-admin-error
{border-color: #C74A4A!important}
+4
View File
@@ -327,7 +327,11 @@ class UM_Admin_Metabox {
delete_post_meta( $post_id, '_um_reveal_fields' );
delete_post_meta( $post_id, '_um_search_fields' );
delete_post_meta( $post_id, '_um_roles_can_search' );
delete_post_meta( $post_id, '_um_show_these_users' );
foreach( $_POST as $k => $v ) {
if ( $k == '_um_show_these_users' && trim( $_POST[ $k ] ) ) {
$v = preg_split('/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY);
}
if (strstr($k, '_um_')){
update_post_meta( $post_id, $k, $v);
}
+14
View File
@@ -7,6 +7,11 @@
}
}
$show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
if ( $show_these_users ) {
$show_these_users = implode("\n", str_replace("\r", "", $show_these_users));
}
?>
<div class="um-admin-metabox">
@@ -73,6 +78,15 @@
</span>
</p><div class="um-admin-clear"></div>
<p>
<label class="um-admin-half"><?php _e('Only show specific users (Enter one username per line)','ultimatemember'); ?></label>
<span class="um-admin-half">
<textarea name="_um_show_these_users" id="_um_show_these_users"><?php echo $show_these_users; ?></textarea>
</span>
</p><div class="um-admin-clear"></div>
<?php do_action('um_admin_extend_directory_options_general', $this); ?>
</div>
+8
View File
@@ -143,6 +143,14 @@
);
}
// show specific usernames
if ( isset( $show_these_users ) && $show_these_users && is_array( $show_these_users ) ) {
foreach( $show_these_users as $username ) {
$users_array[] = username_exists( $username );
}
$query_args['include'] = $users_array;
}
// add roles to appear in directory
if ( !empty( $roles ) ) {
+4 -1
View File
@@ -1168,7 +1168,7 @@ function um_user( $data, $attrs = null ) {
case 'display_name':
$op = um_get_option('display_name');
if ( $op == 'default' ) {
$name = um_profile('display_name');
}
@@ -1183,6 +1183,9 @@ function um_user( $data, $attrs = null ) {
} else {
$name = um_profile( $data );
}
if ( ! $name ) {
$name = um_user('user_login');
}
}
if ( $op == 'sur_name' ) {