Support

Home Forums Event Espresso Premium How can I hide old events and sort by date the events a user has registered for?

How can I hide old events and sort by date the events a user has registered for?

Posted: February 12, 2020 at 12:26 pm


bmarolf

February 12, 2020 at 12:26 pm

Hello, I have this page on my website that a user can go to to see the events they have registered for. Only logged in users with registered events will see the content I will be referring to though. Here is that page: https://www.lighthousehomeschoolers.org/my-event-registrations/

I currently like everything on this page except:
1) events are showing in no sorted order (prefer: in order of date)
2) events that have passed are not hidden (prefer: only future events showing)

This page is using this shortcode:
[ESPRESSO_MY_EVENTS per_page=10 your_events_title=”Events You Registered For” your_tickets_title=”Your Tokens” ]

What tweaks could we make to this shortcode to get the two items of showing the events in order of date and showing only upcoming ones?


Tony

  • Support Staff

February 13, 2020 at 8:15 am

Hi there,

We filter the arguments used on the models to query he registrations/events listed on that section so you can hook i alter them if needed.

To remove expired events you can use the snippet available here:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/tw_ee_filter_getTemplateObjects__query_args.php

You can add that to a custom functions plugin on your site, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

You can also use that same snippet to change the order but adding something like:

$query_args['order_by'] = array('Datetime.DTT_EVT_start' => 'ASC');

Right after Line 16 of that snippet.

If you need to modify the query further I highly recommend taking a look at our model documentation available here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: publish

Updated by  Tony 3 days, 12 hours ago ago

Topic Tags

Tagged: 

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!