mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed member directory sorting by the full name;
- fixed registration form with not editable role field;
This commit is contained in:
@@ -612,7 +612,8 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
|
||||
if ( strstr( $field_key, 'role_' ) && is_array( $field_settings['options'] ) ) {
|
||||
|
||||
if ( $field_settings['editable'] == 0 ) {
|
||||
if ( isset( $this->post_form['mode'] ) && $this->post_form['mode'] == 'profile' &&
|
||||
isset( $field_settings['editable'] ) && $field_settings['editable'] == 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1251,26 +1251,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $sortby == $directory_data['sortby_custom'] || in_array( $sortby, $custom_sort ) ) {
|
||||
|
||||
$custom_sort_type = apply_filters( 'um_member_directory_custom_sorting_type', 'CHAR', $sortby, $directory_data );
|
||||
|
||||
$this->query_args['meta_query'][] = array(
|
||||
'relation' => 'OR',
|
||||
$sortby . '_cs' => array(
|
||||
'key' => $sortby,
|
||||
'compare' => 'EXISTS',
|
||||
'type' => $custom_sort_type,
|
||||
),
|
||||
array(
|
||||
'key' => $sortby,
|
||||
'compare' => 'NOT EXISTS',
|
||||
)
|
||||
);
|
||||
|
||||
$this->query_args['orderby'] = array( $sortby . '_cs' => 'ASC', 'user_login' => 'ASC' );
|
||||
|
||||
} elseif ( 'display_name' == $sortby ) {
|
||||
if ( 'display_name' == $sortby ) {
|
||||
|
||||
$display_name = UM()->options()->get( 'display_name' );
|
||||
if ( $display_name == 'username' ) {
|
||||
@@ -1335,6 +1316,25 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$this->query_args['orderby'] = array( 'last_name_c' => 'ASC', 'first_name_c' => 'ASC' );
|
||||
unset( $this->query_args['order'] );
|
||||
|
||||
} elseif ( ( ! empty( $directory_data['sortby_custom'] ) && $sortby == $directory_data['sortby_custom'] ) || in_array( $sortby, $custom_sort ) ) {
|
||||
|
||||
$custom_sort_type = apply_filters( 'um_member_directory_custom_sorting_type', 'CHAR', $sortby, $directory_data );
|
||||
|
||||
$this->query_args['meta_query'][] = array(
|
||||
'relation' => 'OR',
|
||||
$sortby . '_cs' => array(
|
||||
'key' => $sortby,
|
||||
'compare' => 'EXISTS',
|
||||
'type' => $custom_sort_type,
|
||||
),
|
||||
array(
|
||||
'key' => $sortby,
|
||||
'compare' => 'NOT EXISTS',
|
||||
)
|
||||
);
|
||||
|
||||
$this->query_args['orderby'] = array( $sortby . '_cs' => 'ASC', 'user_login' => 'ASC' );
|
||||
|
||||
} else {
|
||||
|
||||
if ( strstr( $sortby, '_desc' ) ) {
|
||||
|
||||
Reference in New Issue
Block a user