Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created September 18, 2015 11:35
Show Gist options
  • Save Pebblo/525890c30baa7e207e4f to your computer and use it in GitHub Desktop.
Save Pebblo/525890c30baa7e207e4f to your computer and use it in GitHub Desktop.
Add a 'Download your tickets' button to the EE4 thank you page. The hook in use adds the button above the overview, just under the confirmation order section. You will likely need to apply your own styles, possibly a container div and apply styles to that depending on how you want this to be displayed.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_display_download_tickets( $transaction ) {
if ( $transaction instanceof EE_Transaction ) {
$primary_reg = $transaction->primary_registration();
if ( $primary_reg->is_approved() ) {
$reg_url_link = $primary_reg->reg_url_link();
$query_args = array(
'ee' => 'ee-txn-tickets-approved-url',
'token' => $reg_url_link
);
$ticket_url = add_query_arg($query_args, get_site_url());
echo '<a class="ee-button ee-roundish indented-text big-text" href="' . $ticket_url .'">Download your tickets!</a>';
}
}
}
add_action( 'AHEE__thank_you_page_overview_template__content', 'ee_display_download_tickets');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment