I need to make a link to a file display only when an attendee has checked in to a specific event. I went through the documentation but can’t find anything, can you point me in the right direction.
Then hook into that add-on and add a link to the actions column based on the check-in status of the event.
Its possible to conditional show a link based on the current check in status, but so far I can’t give you an example as you don’t have the registration object to check against and need a custom solution to pull that in.
I tried to add the [ESPRESSO_MY_EVENTS] shortcode to an account page that contained a few different chunks of info. The table populated with the correct list but action button was “on” by default and the sub-content was always exposed, not your problem, just and FYI, some conflict with Ultimate member and Paid Membership Pro.
So I simply added a separate page and I get a great table as described. I need some guidance on
Then hook into that add-on and add a link to the actions column based on the check-in status of the event.”
I tried to add the [ESPRESSO_MY_EVENTS] shortcode to an account page that contained a few different chunks of info. The table populated with the correct list but action button was “on” by default and the sub-content was always exposed, not your problem, just and FYI, some conflict with Ultimate member and Paid Membership Pro.
That usually happens when the My Event tables assets (JS and CSS) aren’t loading on the page. Did you add the shortcode directly to the page or using a template with do_shortcode()?
Any examples around?
Not an example of your specific use case, not heres an example of how to add a link to the registrations ticket as a ticket icon:
1) I added the shortcode directly to the page. I am okay for now having My Registrations as separate page, works very well and client is happy.
2) The gist …/Pebblo/08b78a470c74ea1c32b06ade89cc8fd8 is what I need, excellent. It works perfectly when I hard-code the URL into the plugin but I am going to use an ACF field so the client can upload the file as part of the edit event page. I assumed that I could replace What do I replace $file_URL with the filed name but that didn’t work?
if( $checked_in_status == EE_Checkin::status_checked_in ) {
//Set the file URL to use when the user is logged in.
//This example links to Google, you could use an event meta value.
$file_url = "certificate_of_attendance";
//Add the checked in file link to the $actions array.
$actions['checked_in'] = '<a aria-label="' . __( 'Link to checked in file', 'event_espresso' ) . '" href="' . $file_url. '">'
. '<span class="dashicons dashicons-media-archive ee-icon-size-18"></span></a>';
}
The example you sent me is quite elegant, thank you.
The My Event section has no idea what ‘certificate_of_attendance’ of attendance is, and the code above has no idea what to do with it other than to output it directly to the page.
Pass that the meta name and the event ID, which you can get from the registration using:
$EVT_ID = $registration->event_id();
I’d recommend also checking if the get_field function exists first, just in case for some reason ACF is deactivated as your code will then throw a fatal error.
I worked it out based on your feedback. Thank you.
– I need to hide the icon if there is no file uploaded
//Add a link for only checked in registrations.
function tw_add_checked_in_file_to_my_events( $actions, $registration) {
//Check we have an EE_Registration object.
if ( $registration instanceof EE_Registration ) {
//Pull the 'latest' datetime (sorted by date) from the registration.
$latest_related_datetime = $registration->get_latest_related_datetime();
//Check we have an EE_Datetime object.
if( $latest_related_datetime instanceof EE_Datetime) {
//Pull the checked in status for the current registration using the datetime ID we just pulled in.
$checked_in_status = $registration->check_in_status_for_datetime( $latest_related_datetime->ID() );
//Check the checked in status.
if( $checked_in_status == EE_Checkin::status_checked_in ) {
//Set the file URL to use when the user is logged in.
//This example links to Google, you could use an event meta value.
//Get event ID for this ticket
$EVT_ID = $registration->event_id();
//Get the field that holds the URL for the certificate
$certificate = get_field( 'certificate_of_attendance', $EVT_ID );
$file_url = "$certificate";
//Add the checked in file link to the $actions array.
$actions['checked_in'] = '<a aria-label="' . __( 'Link to checked in file', 'event_espresso' ) . '" href="' . $file_url. '" target="_blank">'
. '<span class="dashicons dashicons-media-archive ee-icon-size-18"></span></a>';
}
}
}
return $actions;
}
add_filter( 'FHEE__EES_Espresso_My_Events__actions', 'tw_add_checked_in_file_to_my_events', 10, 2);
//Add a checked in icon to the my events legend.
function tw_add_checked_in_file_to_my_events_legend( $items ) {
$items['ticket'] = array(
'class' => 'dashicons dashicons-media-archive',
'desc' => esc_html__( 'Download Certificate of Attendance', 'event_espresso' )
);
return $items;
}
add_filter( 'FHEE__status-legend-espresso_my_events__legend_items', 'tw_add_checked_in_file_to_my_events_legend');
Why do you have quotes around the above? Those should not be needed.
Inexperienced.
Thank you for your excellent help. All works like a charm now.
FYI – for others
– Series of 4 events per year, same ticket setup, different content
– We have free tickets, an RSVP, for members with paid membership (Paid membership Pro)
– We offer guest tickets as well
– in both cases user must login to RSVP or purchase
– we force login (we have three different Membership/account options)
– non Member cannot RSVP or even see selection option
– event details use Venue display/selection
– event details we added (with People add-on) speaker info/link/photo/blurb using
– event details we added (with ACF) sponsor info/link/logo/blurb
– event details we added (with ACF) “certificate of attendance” document upload file to be available on My Registrations page
– lots of text changes to reflect complexity of “free” RSVP ticket
************
– event archive we added speaker link/photo/blurb
– event archive we added sponsor link/logo
************
– text changes on the Cart/Checkout process
*************
My Registrations page – restrict access/display of certificate document based on Check-in status
************
client using APP for check-ins
************
Client loves mobile access
************
Tested with 1 event – no issues
************
by Company B
************
Event Espresso – Excellent!
The support post ‘Make link (file) available based on Attendee check in status’ 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.