Title:
Version:
Author:
Demo:
Download:
Website:
Short description:
Hi,
default sorting in admin_main.php is by status.
How can I change the default sorting to date by most recent? Or to another field?
Thanks in advance

Moderator: mkoch227
Code: Select all
$sort = 'status';
Code: Select all
/* Acceptable $sort values */
$sort_possible = array('trackid','lastchange','name','subject','status','priority','category','dt','id');
if (isset($_GET['sort']) && in_array($_GET['sort'],$sort_possible))
{
$sort = hesk_input($_GET['sort']);
$sql .= ' ORDER BY `'.hesk_dbEscape($sort).'` ';
}
else
{
$sql .= ' ORDER BY `status` ASC, `priority`';
$sort = 'dt'; <-- changed as you said to me
}
if (isset($_GET['asc']) && $_GET['asc']==0)
{
$sql .= ' DESC ';
$asc = 0;
$asc_rev = 1;
}
else
{
$sql .= ' ASC ';
$asc = 1;
$asc_rev = 0;
if (!isset($_GET['asc']))
{
$is_default = 1;
}
Code: Select all
/* Acceptable $sort values */
$sort_possible = array('trackid','lastchange','name','subject','status','category','dt','id');
if (isset($_GET['sort']) && in_array($_GET['sort'],$sort_possible))
{
$sort = hesk_input($_GET['sort']);
$sql .= ' ORDER BY `'.hesk_dbEscape($sort).'` ';
}
else
{
$sql .= ' ORDER BY `lastchange` DESC, `name`';
$sort = 'lastchange';
}
if (isset($_GET['asc']) && $_GET['asc']==0)
{
$sql .= ' DESC ';
$asc = 0;
$asc_rev = 1;
}
//lines as comment to make sort work
/*else
{
$sql .= ' ASC ';
$asc = 1;
$asc_rev = 0;
if (!isset($_GET['asc']))
{
$is_default = 1;
}
}
*/