Skip to content

Instantly share code, notes, and snippets.

View Pebblo's full-sized avatar
🏠
Working from home

Tony Warwick Pebblo

🏠
Working from home
  • Event Espresso
  • Liverpool, UK
View GitHub Profile
@Pebblo
Pebblo / 0_reuse_code.js
Created April 2, 2014 22:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Pebblo
Pebblo / custom_functions.php
Last active August 29, 2015 14:02
Functions used to send emails when events are created or updated. Change lines 37 and 74 to the email address you wish to send the updates to.
<?php
function ee_event_created_email($params) {
global $wpdb;
$event_id = $params['event_id'];
if(empty($event_id)) {
return;
}
$sql = "SELECT evt.id, evt.event_name, evt.start_date, evt.end_date, se.start_time, se.end_time, v.name as venue_name, v.address, v.address2, v.city, v.state, v.zip FROM " . EVENTS_DETAIL_TABLE . " evt ";
@Pebblo
Pebblo / custom_functions.php
Created August 20, 2014 09:59
Set the default value for the 'Create a post' option within EE3. Place this within your themes functions.php, within wp-content/uploads/espresso/custom_functions.php or a site specific function. Requires 3.1.37+
<?php //Please do not include the opening PHP tag
add_filter('filter_hook_espresso_default_create_post_option', 'ee_return_create_post');
function ee_return_create_post(){
return 'Y';
}
?>
@Pebblo
Pebblo / custom_functions.php
Created August 20, 2014 10:14
Exclude attendee's that have been cancelled from the attendee reports by default in EE3. Requires 3.1.37+
<?php //Please do not include the opening PHP tag
function espresso_exclude_cancelled_payment_status() {
return ' AND a.payment_status != "Cancelled"';
}
add_filter('espresso_attendee_report_payment_status_where', 'espresso_exclude_cancelled_payment_status');
?>
@Pebblo
Pebblo / custom_functions.php
Created September 25, 2014 10:18
A functions to build the ticket list by first pulling the attendee's session_id from the DB, then grabbing all the attendee's within that session and looping through them. This is useful for MER registrations..
<?php //Please do not include the opening PHP tag if there is already one within the file that is still open.
function espresso_ticket_links_by_session($registration_id, $attendee_id, $multi_reg, $email = FALSE) {
global $wpdb;
$sql = "SELECT attendee_session FROM " . EVENTS_ATTENDEE_TABLE;
if (espresso_is_primary_attendee($attendee_id) != true) {
$sql .= " WHERE id = '" . $attendee_id . "' ";
} else {
$sql .= " WHERE registration_id = '" . $registration_id . "' ";
}
@Pebblo
Pebblo / ee_wp_mail_fix.php
Last active August 29, 2015 14:07
A fix for a conflict between WP-EMail and Event Espresso. Once the attendee entered their personal information on the registration page, WP-Email would re-direct the user to a share post form, this removes the action for registration pages. Add this to a site specific plugin or your themes functions.php file.
<?php //Please do not include the opening php tag if one is already open.
function ee_wp_mail_fix()
{
global $this_is_a_reg_page;
if($this_is_a_reg_page) {
remove_action('template_redirect', 'wp_email', 5);
}
}
add_action( 'template_redirect', 'ee_wp_mail_fix', 4 );
@Pebblo
Pebblo / add-GST-to-invoice.php
Last active August 29, 2015 14:14 — forked from joshfeck/add-GST-to-invoice.php
A simple GST line itemizer for the Event Espresso 3 invoice template function file. Works in conjunction with https://gist.github.com/Pebblo/3477fb76d952684fe239
<?php
//* Please do NOT include the above opening php tag
function my_itemised_surcharge( $attendees ){
$options = get_option( 'events_organization_settings' );
$currency = $options['currency_symbol'];
$this->SetFillColor( 239,239,239 );
//var_dump($attendees);
@Pebblo
Pebblo / add-to-template.php
Last active August 29, 2015 14:14 — forked from joshfeck/add-to-template.php
This gist works in conjunction with https://gist.github.com/Pebblo/48b2ce8b15b898a2611f. You can add the following to /gateways/invoice/template.php to display the price without surcharge and surcharge amount as line items on the invoice.
// suggested code placement is right after the line that says:
// $pdf->ImprovedTable($header, $attendees, $w, $alling);
$pdf->Ln(1);
$pdf->my_itemised_surcharge($attendees);
@Pebblo
Pebblo / ee_custom_translate.php
Created February 4, 2015 17:15
Remove ' or ' from the event list page between the 'Register Now' and 'Add to Cart' link. Add this function to your themes functions.php.
<?php
//Please do not include the opening PHP tag.
function mycustom_filter_gettext( $translated, $original, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
' or ' => '',
// Add some more strings here
@Pebblo
Pebblo / attendee_list.php
Last active August 29, 2015 14:15
EE3 [LISTATTENDEES] shortcode that includes a call to include details of the seat the attende has booked. $seatingchart_tag, $seatingchart_seat, $seatingchart_row, $seatingchart_section are all set to empty strings and then the seat number is used to pull in the information from the seating table, this is then assigned to the variables mentioned…
<?php
//List Attendees Template
//Show a list of attendees using a shortcode
//[LISTATTENDEES]
//[LISTATTENDEES limit="30"]
//[LISTATTENDEES show_expired="false"]
//[LISTATTENDEES show_deleted="false"]
//[LISTATTENDEES show_secondary="false"]
//[LISTATTENDEES show_gravatar="true"]
//[LISTATTENDEES paid_only="true"]