Currently, you can’t do that with the models, you can only set a field to order by and ASC or DESC.
I’ve created a feature request ticket to see if this is something we can add into our models but in the meantime, you would need to run the query yourself using $wpdb.
For example, if you use the models to generate a without the order or order_by set, then output the query, you’ll get something like this:
SELECT Registration.REG_ID AS 'Registration.REG_ID', Registration.EVT_ID AS 'Registration.EVT_ID', Registration.ATT_ID AS 'Registration.ATT_ID', Registration.TXN_ID AS 'Registration.TXN_ID', Registration.TKT_ID AS 'Registration.TKT_ID', Registration.STS_ID AS 'Registration.STS_ID', Registration.REG_date AS 'Registration.REG_date', Registration.REG_final_price AS 'Registration.REG_final_price', Registration.REG_paid AS 'Registration.REG_paid', Registration.REG_session AS 'Registration.REG_session', Registration.REG_code AS 'Registration.REG_code', Registration.REG_url_link AS 'Registration.REG_url_link', Registration.REG_count AS 'Registration.REG_count', Registration.REG_group_size AS 'Registration.REG_group_size', Registration.REG_att_is_going AS 'Registration.REG_att_is_going', Registration.REG_deleted AS 'Registration.REG_deleted' FROM wp_esp_registration AS Registration WHERE Registration.REG_deleted = 0 AND Registration.STS_ID IN ('RAP','RNA','RDC','RCN');
Add something like ORDER BY FIND_IN_SET(Registration.STS_ID,'RAP,RNA,RDC,RCN');
to the query and manually run it on your database using $wpdb and you have your results.
Note the above is unsupported and should be considered untested, it’s just something I put together whilst investigating your question.
Viewing 1 reply thread
The support post ‘EE4 – Order by Sort By’ 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.
Support forum for Event Espresso 3 and Event Espresso 4.