Administrator User Management Sort by Options

10 years 10 months ago #83706 by strongcord
Indeed, It would be nice to be able to sort the table under "CB User Manager".
10 years 9 months ago #86181 by cr33dog@gmail.com
Yes - I need to be able to sort on the User Management columns. I will probably attempt this, so any pointers welcome ;) Would be nice to have this in core...

Chris
10 years 9 months ago #86602 by magnotta
I'm interested on this feature too....
Seems curious that I can order users by name, username or email in the General User list of Joomla Backend and I can't in the User Management of CB....
Some hints?
10 years 8 months ago #89747 by Halleck
Hello,

you have to edit Controler and View of the component :

(comments of my code are in french)

change administrator/components/com_profiler/admin.comprofiler.controller.php (at the line +- 1220):
[code:1]/**
modification pour ajouter un tri
____________________________________________________
OLD :
$query .= "\n WHERE aro.section_value = 'users' "
. (count( $where ) ? "\n AND " . implode( ' AND ', $where ) : ""«»)
. "\n LIMIT " . (int) $pageNav->limitstart . ", " . (int) $pageNav->limit
;
*/
//
// récupérer les paramètres
$order = trim( cbGetParam( $_REQUEST, 'order', null ) );
$by = trim( cbGetParam( $_REQUEST, 'orderby', null ) );

//
// défaut, protéger
if(empty($order) || is_null($order) || !is_string($order)) $order = 'asc';
if(empty($by) || is_null($by) || !is_string($by)) $by = 'name';

//
// controler
// on établit une liste de valeurs autorisées, et on regarde si la valeur est dans la liste. Par défaut, on utilisera le premier élément de la liste
$tAuthOrder = array ('ASC', 'DESC');
$tAuthBy = array ('name', 'email', 'username', 'id');
$order = strtoupper($order);
if(!in_array($order, $tAuthOrder)) $order = $tAuthOrder[0];
if(!in_array($by, $tAuthBy)) $by = $tAuthBy[0];

//
// ajouter le tri à la requete sql
$orderby = "\n ORDER BY a.$by $order";

$query .= "\n WHERE aro.section_value = 'users' "
. (count( $where ) ? "\n AND " . implode( ' AND ', $where ) : ""«»)
. $orderby
. "\n LIMIT " . (int) $pageNav->limitstart . ", " . (int) $pageNav->limit
;

/* end tri */[/code:1]

And administrator/components/com_profiler/admin.comprofiler.html.php (at the line +- 1640):
[code:1]
<?php
/**
modification tri des utilisateurs
______________________________________________________
OLD :
<th width="15%" class="title">Name</th>
*/
?>
<th width="15%" class="title">Name
(<a href="<?php echo $mosConfig_live_site; ?>index2.php?option=com_comprofiler&task=showusers&orderby=name&order=asc">asc</a>
/ <a href="<?php echo $mosConfig_live_site; ?>index2.php?option=com_comprofiler&task=showusers&orderby=name&order=desc">desc</a>«»)
</th>[/code:1]you can do it for the other <th>...

Enjoy ! :-)

Post edited by: Halleck, at: 2009/02/24 17:52
10 years 4 months ago #103731 by cdfisherman
Hi, have you found a plug or way to sort the CB User Manager table? I need to sort this table by Name.

Thanks
10 years 4 months ago #103733 by cdfisherman
Hi, has anyone tried this?
I'm not a programmer and was not able to find the lines of code you mention the were the old code in the file.

Some more help would be appreciated.
Moderators: beatnantkrileon
Time to create page: 0.473 seconds
Facebook Twitter Google LinkedIn