Forked from Pebblo/ee_display_download_tickets.php
Last active
June 20, 2018 15:15
-
-
Save joshfeck/e5157985141ad04d28fb140a8b12614d to your computer and use it in GitHub Desktop.
Add a 'Download your tickets' button & the QR code to the EE4 thank you page. The hook in use adds the button & QR code before the overview, just after 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.
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 | |
//* 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 '<p class="jst-cntr"><a class="ee-button ee-roundish indented-text big-text" href="' . $ticket_url .'">Download your tickets!</a></p>'; | |
echo '<p class="jst-cntr"><img src=http://chart.apis.google.com/chart?cht=qr&chs=200x200&chl=' . $reg_url_link . '&chld=H|0 alt="QR Code" /></p>'; | |
} | |
} | |
} | |
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