- fixed sorting by user registered date when custom meta table is enabled;

This commit is contained in:
Mykyta Synelnikov
2024-02-14 17:12:35 +02:00
parent 17c1b2a250
commit cb9818e41c
2 changed files with 19 additions and 2 deletions
@@ -900,7 +900,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) {
$order = esc_sql( $order );
$order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC';
$this->sql_order = " ORDER BY CAST( umm_sort.um_value AS CHAR ) {$order} ";
} elseif ( in_array( $sortby, $this->core_search_fields, true ) ) {
} elseif ( in_array( $sortby, $this->core_users_fields, true ) ) {
$sortby = esc_sql( $sortby );
$order = esc_sql( $order );
$order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC';
+18 -1
View File
@@ -58,7 +58,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
var $filter_types = array();
/**
* Fields used for searching from wp_users table.
*
* @var string[]
*/
var $core_search_fields = array(
'user_login',
'user_url',
@@ -67,6 +71,19 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
'user_nicename',
);
/**
* Fields used for sorting from wp_users table.
*
* @var string[]
*/
var $core_users_fields = array(
'user_login',
'user_url',
'display_name',
'user_email',
'user_nicename',
'user_registered',
);
/**
* @var