Support

Home Forums Event Espresso Premium How to make 'sort registration by event date' work predictable?

How to make 'sort registration by event date' work predictable?

Posted: February 17, 2022 at 8:47 am

Viewing 1 reply thread


Henrik

February 17, 2022 at 8:47 am

Hello, we having an issue with sorting events by event date on Event Espresso 4.10.11.p: no matter what order direction is chosen at the column ‘Event date’, order is going firstly by column Reg Date, then Event date.
Client requires to make sorting by event date fist, then Reg Date. We are lost in our attempt to do it: no matter what we do, we can’t find the way to make event start date the first priority for sorting.
We would be glad to get any help.

On a screenshot is part of our request
/wp-admin/admin.php?page=espresso_registrations&orderby=DTT_EVT_start&order=asc


Tony

  • Support Staff

February 22, 2022 at 1:24 pm

Hi there,

Are you sure the query is ordering by Reg Date?

The reason I ask is by default the Query will order by Event___Datetime.DTT_EVT_start asc, Registration.REG_ID asc

You can confirm this using a plugin such as Debug Bar, although you may need to add:

define( 'SAVEQUERIES', true );

To your sites wp-config.php to get it to show the queries, when I’m testing I use:

define( 'WP_DEBUG', true );
if ( WP_DEBUG ) {
        @ini_set( 'display_errors', 1 );
        define( 'WP_DEBUG_LOG', true );
        define( 'WP_DEBUG_DISPLAY', false );
        define( 'SAVEQUERIES', true );
        define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
}

Mine shows: https://monosnap.com/file/hNBVsWnSMFKQmwxNg4hBmLxIbmoR6b

We don’t have a filter you can use to change those query parameters currently, BUT I can tell you how to change the code to see if it actually fixes your issue (I’m not so sure it will).

In \event-espresso-core-reg\admin_pages\registrations\Registrations_Admin_Page.core.php

Around line 1262 should be $query_params['group_by'] = '';

Right below that add:

unset($query_params['order_by']['REG_ID']);

It should be something like this:

https://monosnap.com/file/0gobaAmKkn83ZxxMNs9O7gQzymAtjM

See if that makes a difference as you’ll then only be ordered by the Start Date.

Note I’m NOT suggesting you leave the above code in place but rather use it to test if it makes a difference.

May I ask why you are still using version 4.10.11.p? The latest version is currently 4.10.26.p

Viewing 1 reply thread

The support post ‘How to make 'sort registration by event date' work predictable?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso