mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-20 15:13:55 +09:00
- visual improvements for member directory;
- fixed must search/filter option;
This commit is contained in:
@@ -59,33 +59,33 @@ foreach ( $view_types_options as $key => $value ) {
|
||||
'conditional' => array( implode( '|', $conditional ), '~', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_roles',
|
||||
'type' => 'multi_checkbox',
|
||||
'label' => __( 'User Roles to Display', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If you do not want to show all members, select only user roles to appear in this directory', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'id' => '_um_roles',
|
||||
'type' => 'multi_checkbox',
|
||||
'label' => __( 'User Roles to Display', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If you do not want to show all members, select only user roles to appear in this directory', 'ultimate-member' ),
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'columns' => 3,
|
||||
'value' => $_um_roles_value,
|
||||
'value' => $_um_roles_value,
|
||||
),
|
||||
array(
|
||||
'id' => '_um_has_profile_photo',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Only show members who have uploaded a profile photo', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If \'Use Gravatars\' as profile photo is enabled, this option is ignored', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_has_profile_photo' ),
|
||||
'id' => '_um_has_profile_photo',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Only show members who have uploaded a profile photo', 'ultimate-member' ),
|
||||
'tooltip' => __( 'If \'Use Gravatars\' as profile photo is enabled, this option is ignored', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_has_profile_photo' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_has_cover_photo',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Only show members who have uploaded a cover photo', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_has_cover_photo' ),
|
||||
'id' => '_um_has_cover_photo',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Only show members who have uploaded a cover photo', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_has_cover_photo' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_show_these_users',
|
||||
'type' => 'textarea',
|
||||
'label' => __( 'Only show specific users (Enter one username per line)', 'ultimate-member' ),
|
||||
'value' => $show_these_users,
|
||||
)
|
||||
'id' => '_um_show_these_users',
|
||||
'type' => 'textarea',
|
||||
'label' => __( 'Only show specific users (Enter one username per line)', 'ultimate-member' ),
|
||||
'value' => $show_these_users,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -111,9 +111,9 @@ foreach ( $view_types_options as $key => $value ) {
|
||||
$fields = apply_filters( 'um_admin_extend_directory_options_general', $fields );
|
||||
|
||||
UM()->admin_forms( array(
|
||||
'class' => 'um-member-directory-general um-half-column',
|
||||
'prefix_id' => 'um_metadata',
|
||||
'fields' => $fields
|
||||
'class' => 'um-member-directory-general um-half-column',
|
||||
'prefix_id' => 'um_metadata',
|
||||
'fields' => $fields
|
||||
) )->render_form(); ?>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
@@ -5,29 +5,10 @@ global $post_id; ?>
|
||||
|
||||
<div class="um-admin-metabox">
|
||||
<?php
|
||||
/*$_um_roles_search_value = array();
|
||||
$_um_roles_search = get_post_meta( $post_id, '_um_roles_can_search', true );
|
||||
if ( ! empty( $_um_roles_search ) ) {
|
||||
foreach ( UM()->roles()->get_roles() as $key => $value ) {
|
||||
if ( in_array( $key, array_keys( $_um_roles_search ) ) ) {
|
||||
$_um_roles_search_value[] = $key;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$_um_roles_search_value = get_post_meta( $post_id, '_um_roles_can_search', true );
|
||||
$_um_roles_search_value = empty( $_um_roles_search_value ) ? array() : $_um_roles_search_value;
|
||||
|
||||
/*$_um_roles_filter_value = array();
|
||||
$_um_roles_filter = get_post_meta( $post_id, '_um_roles_can_filter', true );
|
||||
if ( ! empty( $_um_roles_filter ) ) {
|
||||
foreach ( UM()->roles()->get_roles() as $key => $value ) {
|
||||
if ( in_array( $key, array_keys( $_um_roles_filter ) ) ) {
|
||||
$_um_roles_filter_value[] = $key;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$_um_roles_filter_value = get_post_meta( $post_id, '_um_roles_can_filter', true );
|
||||
$_um_roles_filter_value = empty( $_um_roles_filter_value ) ? array() : $_um_roles_filter_value;
|
||||
|
||||
@@ -53,7 +34,7 @@ global $post_id; ?>
|
||||
* ?>
|
||||
*/
|
||||
$custom_search = apply_filters( 'um_admin_custom_search_filters', array() );
|
||||
$searchable_fields = UM()->builtin()->all_user_fields('date,time,url');
|
||||
$searchable_fields = UM()->builtin()->all_user_fields( 'date,time,url' );
|
||||
$searchable_fields = $searchable_fields + $custom_search;
|
||||
$user_fields = array();
|
||||
foreach ( $searchable_fields as $key => $arr ) {
|
||||
|
||||
@@ -138,26 +138,45 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
) );
|
||||
|
||||
$this->core_directory_meta['members'] = array(
|
||||
'_um_core' => 'members',
|
||||
'_um_template' => 'members',
|
||||
'_um_mode' => 'directory',
|
||||
'_um_view_types' => array( 'grid' ),
|
||||
'_um_default_view' => 'grid',
|
||||
'_um_roles' => array(),
|
||||
'_um_has_profile_photo' => 0,
|
||||
'_um_has_cover_photo' => 0,
|
||||
'_um_show_social' => 0,
|
||||
'_um_show_userinfo' => 0,
|
||||
'_um_show_tagline' => 0,
|
||||
'_um_search' => 0,
|
||||
'_um_userinfo_animate' => '1',
|
||||
'_um_show_these_users' => '',
|
||||
|
||||
'_um_sortby' => 'user_registered_desc',
|
||||
'_um_sortby_custom' => '',
|
||||
'_um_enable_sorting' => 0,
|
||||
'_um_sorting_fields' => array(),
|
||||
|
||||
'_um_profile_photo' => '1',
|
||||
'_um_cover_photos' => '1',
|
||||
'_um_show_name' => '1',
|
||||
'_um_show_tagline' => 0,
|
||||
'_um_tagline_fields' => array(),
|
||||
'_um_show_userinfo' => 0,
|
||||
'_um_reveal_fields' => array(),
|
||||
'_um_show_social' => 0,
|
||||
'_um_userinfo_animate' => '1',
|
||||
|
||||
'_um_search' => 0,
|
||||
'_um_roles_can_search' => array(),
|
||||
'_um_filters' => 0,
|
||||
'_um_roles_can_filter' => array(),
|
||||
'_um_search_fields' => array(),
|
||||
'_um_search_filters' => '',
|
||||
|
||||
'_um_must_search' => 0,
|
||||
'_um_max_users' => '',
|
||||
'_um_profiles_per_page' => 12,
|
||||
'_um_profiles_per_page_mobile' => 6,
|
||||
'_um_directory_header' => __( '{total_users} Members', 'ultimate-member' ),
|
||||
'_um_directory_header_single' => __( '{total_users} Member', 'ultimate-member' ),
|
||||
'_um_directory_no_users' => __( 'We are sorry. We cannot find any users who match your search criteria.', 'ultimate-member' ),
|
||||
'_um_profiles_per_page' => 12,
|
||||
'_um_profiles_per_page_mobile' => 6,
|
||||
'_um_core' => 'members',
|
||||
);
|
||||
|
||||
$this->core_global_meta_all = array(
|
||||
|
||||
@@ -15,7 +15,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
* @method UM_Instagram_API Instagram_API()
|
||||
* @method UM_Mailchimp Mailchimp()
|
||||
* @method UM_Messaging_API Messaging_API()
|
||||
* @method UM_myCRED_API myCRED_API()
|
||||
* @method UM_myCRED myCRED()
|
||||
* @method UM_Notices_API Notices_API()
|
||||
* @method UM_Notifications_API Notifications_API()
|
||||
* @method UM_Online Online()
|
||||
|
||||
@@ -411,6 +411,9 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
* ?>
|
||||
*/
|
||||
$attrs = apply_filters( 'um_search_fields', $attrs );
|
||||
|
||||
$unique_hash = substr( md5( $directory_data['form_id'] ), 10, 5 );
|
||||
|
||||
ob_start();
|
||||
|
||||
switch ( $this->filter_types[ $filter ] ) {
|
||||
@@ -422,6 +425,9 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
}
|
||||
case 'select': {
|
||||
|
||||
// getting value from GET line
|
||||
$filter_from_url = ! empty( $_GET[ 'filter_' . $filter . '_' . $unique_hash ] ) ? explode( '||', sanitize_text_field( $_GET[ 'filter_' . $filter . '_' . $unique_hash ] ) ) : array();
|
||||
|
||||
if ( isset( $attrs['metakey'] ) && strstr( $attrs['metakey'], 'role_' ) ) {
|
||||
$shortcode_roles = get_post_meta( UM()->shortcodes()->form_id, '_um_roles', true );
|
||||
$um_roles = UM()->roles()->get_roles( false );
|
||||
@@ -475,7 +481,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$opt = $k;
|
||||
} ?>
|
||||
|
||||
<option value="<?php echo $opt; ?>" data-value_label="<?php esc_attr_e( $v, 'ultimate-member' ); ?>">
|
||||
<option value="<?php echo esc_attr( $opt ); ?>" data-value_label="<?php esc_attr_e( $v, 'ultimate-member' ); ?>"
|
||||
<?php disabled( ! empty( $filter_from_url ) && in_array( $opt, $filter_from_url ) ) ?>>
|
||||
<?php _e( $v, 'ultimate-member' ); ?>
|
||||
</option>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user