Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created October 30, 2017 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/08b78a470c74ea1c32b06ade89cc8fd8 to your computer and use it in GitHub Desktop.
Save Pebblo/08b78a470c74ea1c32b06ade89cc8fd8 to your computer and use it in GitHub Desktop.
An example of how to include a custom link to the 'actions' column of the My Events section based on the check in status.
<?php //Please do not include the opening PHP tag if you already have one
//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.
$file_url = "https://google.com";
//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>';
}
}
}
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__( 'Checked in file', 'event_espresso' )
);
return $items;
}
add_filter( 'FHEE__status-legend-espresso_my_events__legend_items', 'tw_add_checked_in_file_to_my_events_legend');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment