-
-
Save Pebblo/4817ecea1b6d93da665f to your computer and use it in GitHub Desktop.
An example of how to pull in the latest approved registration details across all events.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function latest_reg_details() { | |
$query_params = array( | |
array( | |
'STS_ID' => EEM_Registration::status_id_approved | |
), | |
'limit' => 1, | |
'order' => 'DESC' | |
); | |
$regs = EEM_Registration::instance()->get_all( $query_params ); | |
$registration = reset($regs); | |
if ( $registration instanceof EE_Registration ) { | |
$attendee = $registration->attendee(); | |
if ( $attendee instanceof EE_Attendee ) { | |
/* Here you have access to the EE_Attendee object for the latest 'Approved' registration */ | |
// Kint debug | |
// d($attendee); | |
//Get the full name of the attendee. | |
$name = $attendee->full_name(); | |
//Get the event from the registration. | |
$event = $registration->event(); | |
//d($event); | |
return $output = 'Join ' . $name . ', who registered onto ' . $event->name(); | |
} | |
} | |
} | |
add_shortcode('LATEST_REGISTRATION_DETAILS','latest_reg_details'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment