Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Events Ordering so Upcoming first and Ongoing after

9 years 11 months ago
  • Vlad's Avatar
    Topic Author
  • Vlad
  • Offline
  • Fresh Boarder
  • Posts: 26
  • Thank you received: 4
Licenses:
JomSocial Expired

How can I order Events so the page displays Upcoming events first (startdate > now) and Ongoing events (startdate < now and enddate > now) after that?

I see the models/events.php -- should I update the query there? and how?

thanks

9 years 11 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Vlad,

WEll, this hack is bit tricky, because you need to move the ongoing toe the last, and move the upcoming to the top.

this is not the smart solution but you can try it.. In models/events.php, find this code :

case 'startdate':
                if (empty($orderBy))
                    $orderBy = ' ORDER BY a.startdate ASC';
                break;
            default:
                $orderBy = ' ORDER BY a.' . $db->quoteName('startdate') . ' ASC';
                break;

and change to :
case 'startdate':
                if (empty($orderBy))
                    $orderBy = ' ORDER BY a.startdate DESC';
                break;
            default:
                $orderBy = ' ORDER BY a.' . $db->quoteName('startdate') . ' DESC';
                break;

I hope it will help.

Thank you

9 years 11 months ago
  • Vlad's Avatar
    Topic Author
  • Vlad
  • Offline
  • Fresh Boarder
  • Posts: 26
  • Thank you received: 4
Licenses:
JomSocial Expired

That solution is not right -- it shows events in reverse order (basically moving events with further/latest date in the first place). any other recommendations?

9 years 10 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Vlad,

Like I said before, this is really tricky, because you need to manipulate the array result.. we cant help you too much for this one.

thank you

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW