From b2d917036d3a2e4639f5ae69fdd5489cd51f17fd Mon Sep 17 00:00:00 2001 From: patrick Date: Sun, 7 Jul 2019 04:12:19 +1000 Subject: [PATCH] sort staff and client by first name --- ts.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ts.php b/ts.php index eeed874..6b0fc44 100644 --- a/ts.php +++ b/ts.php @@ -189,7 +189,7 @@ class AcareOffice{ 'users' => [], ); //search all users that are staff - $staffq = new \WP_User_Query(array('role'=>'staff')); + $staffq = new \WP_User_Query(array('role'=>'staff','meta_key'=>'first_name', 'orderby'=>'meta_value', order=>'ASC')); $staff = $staffq->get_results(); if (! empty($staff)){ $response['status'] = 'success'; @@ -220,7 +220,7 @@ class AcareOffice{ 'users' => [], ); //search all users that are staff - $clientq = new \WP_User_Query(array('role'=>'client')); + $clientq = new \WP_User_Query(array('role'=>'client', 'meta_key'=>'first_name', 'orderby'=>'meta_value', order=>'ASC')); $client = $clientq->get_results(); if (! empty($client)){ $response['status'] = 'success'; @@ -246,7 +246,7 @@ class AcareOffice{ private function get_people_by_role($role){ //search all users that are staff - $staffq = new \WP_User_Query(array('role'=>$role)); + $staffq = new \WP_User_Query(array('role'=>$role, 'meta_key'=>'first_name', 'orderby'=>'meta_value', order=>'ASC')); $staff = $staffq->get_results(); return $staff; }