Fixed sorting in admin listing
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 20 May 2015 20:39:53 +0000 (16:39 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 20 May 2015 20:39:53 +0000 (16:39 -0400)
classes/class.bMembers.php

index 7311dd0..8d926ca 100644 (file)
@@ -26,8 +26,9 @@ class BMembers extends WP_List_Table {
 
     function get_sortable_columns() {
         return array(
-            'member_id' => array('member_id', true),
-            'user_name' => array('user_name', true)
+//            'member_id' => array('member_id', true),
+            'user_name' => array('user_name', true),
+            'last_name' => array('last_name', true)
         );
     }
 
@@ -75,7 +76,7 @@ class BMembers extends WP_List_Table {
         
         $sortable_columns = $this->get_sortable_columns();
         $orderby = BUtils::sanitize_value_by_array($orderby, $sortable_columns);
-        $order = BUtils::sanitize_value_by_array($order, array('DESC' => '1', 'ASC' => '1'));
+        $order = BUtils::sanitize_value_by_array($order, array('ASC' => '1', 'DESC' => '1'));
 
         $query.=' ORDER BY ' . $orderby . ' ' . $order;
         $totalitems = $wpdb->query($query); //return the total number of affected rows