- fixed member directory sorting by the full name;

- fixed registration form with not editable role field;
This commit is contained in:
nikitasinelnikov
2020-10-14 11:42:59 +03:00
parent f9893236e6
commit 255acd7c0a
2 changed files with 22 additions and 21 deletions
+2 -1
View File
@@ -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;
}
+20 -20
View File
@@ -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' ) ) {