Support

Home Forums Event Espresso Premium Accessing Event information programmatically while on the registration page

Accessing Event information programmatically while on the registration page

Posted: November 18, 2014 at 12:32 pm


Scott Stephanoff

November 18, 2014 at 12:32 pm

Hello,

I am wanting to add in some specific stylesheets and js if the user is viewing a particular event’s page – not a problem until it goes to the registration and the POST no longer references the event, but is the registration page instead. How can retrieve data on the event that is being displayed on the registration page? EE_Core::get_event(); – hoping for something of the sort.


Sidney Harrell

November 19, 2014 at 10:13 am

You would need to write a function and add it to the ‘AHEE__registration_page_attendee_information__start’ action. That action passes a var called $event_queue to functions that are hooked to it which contains an array with the key “items” which is an array of cart line items and each line item has a key called “event” which contains the event object. Then it should be easy enough to check the event object’s id and comparing it to the list of event id’s that you want to check for and enqueueing the CSS and JS if there is a match.


Scott Stephanoff

November 19, 2014 at 10:19 am

Hi Sidney,

Thanks for the reply. I imagine this is better than accessing that information directly through the Registry object, as I believe you can get to cart data through the EE_Registry::instance(); as well, however tying into the hook would likely be a safer way of ensuring all required calls have run rather than depending of the placement of wp_enqueue_scripts being far enough along in the process.

$registry =


Dean

November 20, 2014 at 6:12 am

Not sure if this will help, but I had to get the event ID in the same location for another customer today and came up with this https://gist.github.com/Apina/8f4139e76670df2f6bc6

The support post ‘Accessing Event information programmatically while on the registration page’ 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