Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created October 27, 2016 05:16
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 joshfeck/76fbc79e077622c7a980b951c854d935 to your computer and use it in GitHub Desktop.
Save joshfeck/76fbc79e077622c7a980b951c854d935 to your computer and use it in GitHub Desktop.
See https://eventespresso.com/topic/promotion-early-bird-advice/#post-220473 for an explanation of what this code can do for you.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function tw_espresso_vip_tickets( $ticket_row_html, EE_Ticket $ticket ) {
global $post;
// Array of password protected post or page IDs
// and their corresponding VIP tickets
$VIP_array = array(
array (
'id' => 52315,
'tickets' => array( // group 1 vip tickets
645, 650,
)
),
array (
'id' => 52317,
'tickets' => array( // group 2 vip tickets
649, 651,
)
),
);
// Array of ticket IDs to show *everywhere*
$everywhere_tkt_ids = array(
646,
652,
);
// start loop
foreach ($VIP_array as $page ) {
$VIP_Post_ID = $page['id'];
if ( $post instanceof WP_Post &&
( ( $post->ID != $VIP_Post_ID ) && //not a VIP post and
in_array( $ticket->ID(), $page['tickets'] ) ) || //is a VIP ticket or
( $post->ID == $VIP_Post_ID ) && //is a VIP post and
( ! in_array( $ticket->ID(), $page['tickets'] ) && //not a VIP ticket and
! in_array( $ticket->ID(), $everywhere_tkt_ids ) ) //not an everywhere ticket
) {
return ''; // return nothing
}
}
return $ticket_row_html; // return a ticket row
}
add_filter( 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', 'tw_espresso_vip_tickets', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment