Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created June 19, 2013 16:31
Show Gist options
  • Select an option

  • Save joshfeck/5815708 to your computer and use it in GitHub Desktop.

Select an option

Save joshfeck/5815708 to your computer and use it in GitHub Desktop.
Exclude the primary attendee count from the confirmation page and adjust the price to exclude the primary attendee. Requires Event Espresso 3.1.34.P or later.
//Calculate number of attendees, minus the primary attendee
function espresso_exclude_primary_attendee() {
$sql = " AND is_primary = '0' ";
return $sql;
}
add_filter('filter_hook_espresso_payment_page_count_attendees_sql_where', 'espresso_exclude_primary_attendee', 10);
//Make the primary attendee free
function espresso_primary_attendee_is_free($registration_id) {
global $wpdb;
$SQL = " UPDATE " . EVENTS_ATTENDEE_TABLE . " ";
$SQL .= "SET final_price = '0.00', orig_price = '0.00' ";
$SQL .= "WHERE registration_id = %s AND is_primary = '1'";
$wpdb->query( $wpdb->prepare( $SQL, $registration_id ));
}
add_action('action_hook_espresso_confirmation_page_before', 'espresso_primary_attendee_is_free', 10, 1);
//Changes the primary attendee count to 0 on the confirmation display page
function espresso_adjust_primary_attendee_count() {
return 0;
}
add_filter('action_hook_espresso_confirmation_page_primary_attendee_count', 'espresso_primary_attendee_count', 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment