Updated sort order for session dates in Making Tracks courses

I needed to update the session date order in the Making Tracks course listings so I used a custom sort function and all is well.
Here’s a image of the dates and times for this session sorted correctly:
Screen shot

Previously it was sorted in reverse.

Backend Info

getField('dt_start_date')) ==
         strtotime($dateTime2->getField('dt_start_date')) ) {
        return 0;
    }
    //echo '<!-- datetime1: '.$dateTime1.', dateTime2: '.$dateTime2.'-->';
    return ( strtotime($dateTime1-&gt;getField('dt_start_date')) &gt; strtotime($dateTime2-&gt;getField('dt_start_date')) ) ? +1 : -1;
    #reverse it:
    //return ( strtotime($dateTime1-&gt;getField('dt_start_date')) &gt; strtotime($dateTime2-&gt;getField('dt_start_date')) ) ? -1 : +1;
}
  //Sort datetimes by endDate
if(count($datetimes) &gt; 1) {
  //We need this as 'reverse_date_time_order' =&gt; true in $session_params changes all date ordering to reverse which doen't work well for course listings. So I changed it to false and Rev. sort here.
  usort($datetimes, "cmp_obj_startDate2");
}
Leave a Comment