Good news, I found the issue. It turns out I am trying to adjust the wrong query leading to the user list being sorted according to user_login and not points.
I will include a fix in the next update, till then you can fix it by changing the following in the mycred-admin.php file located in /mycred/includes/
On line 44 change:
add_action( 'pre_get_posts', array( $this, 'sort_by_points' ) );
to:
add_action( 'pre_user_query', array( $this, 'sort_by_points' ) );
And on line 143 change:
/**
* Sort by Points
* @since 1.2
* @version 1.0
*/
public function sort_by_points( $query ) {
if ( !is_admin() ) return;
$screen = get_current_screen();
if ( $screen->id != 'users' || !isset( $query->orderby ) ) return;
$orderby = $query->get( 'orderby' );
if ( 'mycred' == $oderby ) {
$query->set( 'meta_key', $this->core->get_cred_id() );
$query->set( 'orderby', 'meta_value_num' );
}
}
To:
/**
* Sort by Points
* @since 1.2
* @version 1.1
*/
public function sort_by_points( $query ) {
if ( !is_admin() ) return;
$screen = get_current_screen();
if ( $screen->id != 'users' ) return;
$orderby = $query->get( 'orderby' );
if ( 'mycred' == $orderby ) {
global $wpdb;
$cred_id = $this->core->get_cred_id();
$order = $query->get( 'order' );
$query->query_from .= " LEFT JOIN {$wpdb->usermeta} ON ({$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND {$wpdb->usermeta}.meta_key = '$cred_id')";
$query->query_orderby = "ORDER BY {$wpdb->usermeta}.meta_value+0 $order ";
}
}