hi,
changing
if ($advSort == $sortBy){
$ditto->customSort($resource, $advSort, $sortDir);
}
to
$ditto->customSort($resource, $advSort, $sortDir);
gets it working! at this point I know enough about your code to really start breaking things.

but not enough to find the real source of the bug. i do know however, that this code:
$sortBy = isset($sortBy) ? $ditto->checkSort($sortBy, $dateFormatType, $mode) : "createdon";
// get sortBy
sets $sortBy to "id", when before this validation routine its the name of the template variable. is this right?
thanks mark! i’m content with my ugly hack for now but I’d sure like to help you with the real solution.