Page 1 of 1
[SOLVED] Need help editing listusers.php in admin
Posted: Fri Oct 10, 2008 10:58 pm
by sugna
Version 1.4.1
I want to change the way the Users display when viewing User's in the Admin.
I want to:
Display the Users by last name and first name
This works but need to know how to put a space in between last name and first name
Code: Select all
echo "<td><a href=\"edituser.php?user_id=".$oneuser->id."\">".$oneuser->lastname , $oneuser->firstname."</a></td>\n";
Display the list in alpha order
I tried this but no luck ordering by lastname in Alpha order Example abcde etc.
Code: Select all
$query = "SELECT user_id, username, active FROM ".cms_db_prefix()."users ORDER BY username";
Thanks all for your help,
Shane
Re: Need help editing listusers.php in admin
Posted: Sat Oct 11, 2008 6:56 am
by Dee
sugna wrote:
This works but need to know how to put a space in between last name and first name
Code: Select all
echo "<td><a href="edituser.php?user_id=".$oneuser->id."">".$oneuser->lastname , $oneuser->firstname."</a></td>\n";
Code: Select all
echo "<td><a href="edituser.php?user_id=" . $oneuser->id . "">" . "$oneuser->lastname $oneuser->firstname</a></td>\n";
or
Code: Select all
echo "<td><a href="edituser.php?user_id=" . $oneuser->id . "">" . $oneuser->lastname . ' ' . $oneuser->firstname . "</a></td>\n";
sugna wrote:
Display the list in alpha order
I tried this but no luck ordering by lastname in Alpha order Example abcde etc.
Code: Select all
$query = "SELECT user_id, username, active FROM ".cms_db_prefix()."users ORDER BY username";
It looks like you're ordering by username instead of lastname, try:
Code: Select all
$query = "SELECT user_id, username, active FROM ".cms_db_prefix()."users ORDER BY lastname";
Grtz,
D
Re: Need help editing listusers.php in admin
Posted: Sat Oct 11, 2008 1:04 pm
by sugna
Thanks Dee,
Question two not solved.
This
Code: Select all
$query = "SELECT user_id, username, active FROM ".cms_db_prefix()."users ORDER BY lastname";
Won't display the users in alpha order for some reason. I would expect it to.
Does something else control the display. Reason why I ask is because the firstname is in Alpha order
Question one is solved.
Re: Need help editing listusers.php in admin
Posted: Sat Oct 11, 2008 1:43 pm
by Dee
Hmmm, it seems the query in listusers.php is executed but not used at all - the userlist is aquired using $userops->LoadUsers();
To order the users by lastname edit the file classes/class.useroperations.inc.php and change the query on line 46:
Code: Select all
$query = "SELECT user_id, username, password, first_name, last_name, email, active, admin_access FROMĀ ".cms_db_prefix()."users ORDER BY lastname";
Regards,
D
Re: Need help editing listusers.php in admin
Posted: Sat Oct 11, 2008 2:25 pm
by sugna
Thanks Dee,
Presto! [SOLVED] one note the row would be "last_name" not lastname for anyone else that wants t do this.
So the q is
Code: Select all
$query = "SELECT user_id, username, password, first_name, last_name, email, active, admin_access FROM ".cms_db_prefix()."users ORDER BY last_name";
Thanks Dee