Skip to content

Instantly share code, notes, and snippets.

View sidharrell's full-sized avatar

Sidney Harrell sidharrell

  • Vivian-Harrell Web Development Studios, LLC
  • Harpers Ferry, WV, United States
View GitHub Profile
@sidharrell
sidharrell / gist:8464476
Created January 16, 2014 22:12
diff for apply coupon to cart once modification
--- a/includes/admin-files/optional_event_settings.php
+++ b/includes/admin-files/optional_event_settings.php
@@ -103,7 +103,13 @@ $values=array(
<?php _e('Allow discounts in the shopping cart?','event_espresso'); ?>
</label>
<?php echo select_input('allow_mer_discounts', $values, isset($org_options['allow_mer_discounts']) ? $org_options['allow_mer_discounts'] : ''); ?> <br />
- </li>
+ </li>
+ <li>
+ <label>
@sidharrell
sidharrell / gist:8531452
Created January 20, 2014 23:26
email payment notification to primary attendee only
function event_espresso_send_payment_notification($atts) {
do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
global $org_options;
//Extract the attendee_id and registration_id
extract($atts);
event_espresso_email_confirmations(array('attendee_id' => $attendee_id, 'send_admin_email' => 'false', 'send_attendee_email' => 'true', 'custom_data' => array('email_type' => 'payment', 'payment_subject' => $org_options['payment_subject'], 'payment_message' => $org_options['payment_message'])));
return;
}
@sidharrell
sidharrell / gist:8564820
Created January 22, 2014 18:49
reject attendees by email address. place blocked email addresses in uploads/espresso/blocks.txt one email per line.
function espresso_reject_attendee_by_email_address($attendee_data) {
if(file_exists(EVENT_ESPRESSO_UPLOAD_DIR."blocks.txt")) {
$blocks = file(EVENT_ESPRESSO_UPLOAD_DIR."blocks.txt",FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if(in_array($attendee_data['email'], $blocks)) {
global $wpdb;
$wpdb->delete(EVENTS_ATTENDEE_TABLE, array('id'=>$attendee_data['attendee_id']), array('%d'));
}
}
}
add_action('action_hook_espresso_save_attendee_data', 'espresso_reject_attendee_by_email_address');
@sidharrell
sidharrell / gist:8592212
Created January 24, 2014 04:46
cool sortable attendee list
<?php
// add as uploads/espresso/templates/attendee_list.php
// note the enqueue script on line 47. You'll need to upload sortable.min.js and adjust the location
// also it has been customized for questions #39 and 40. YMMV.
//List Attendees Template
//Show a list of attendees using a shortcode
//[LISTATTENDEES]
//[LISTATTENDEES limit="30"]
//[LISTATTENDEES show_expired="false"]
@sidharrell
sidharrell / gist:8652848
Created January 27, 2014 17:10
email confirmations when invoice finalize link is clicked
// Add this section to the end of gateways/invoice/init.php
// This is for the thank you page
if (!empty($_REQUEST['type']) && $_REQUEST['type'] == 'invoice') {
event_espresso_require_gateway("invoice/invoice_ipn.php");
add_filter('filter_hook_espresso_transactions_get_attendee_id', 'espresso_transactions_invoice_get_attendee_id');
add_filter('filter_hook_espresso_thank_you_get_payment_data', 'espresso_process_invoice');
}
@sidharrell
sidharrell / gist:8738915
Last active August 29, 2015 13:55
patch for non-standard date formats with php >= 5.3
function espresso_ical_prepare_by_meta($meta, $title = '', $image = '', $link_only = FALSE) {
global $org_options, $wpdb;
do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
if ( !empty($org_options['display_ical_download']) && $org_options['display_ical_download'] == 'N' || !isset($org_options['display_ical_download']) ){
return;
}
$start_date_object = DateTime::createFromFormat(get_option('date_format').' G:i', $meta['start_date'] . ' ' . $meta['start_time']);
$start_date = !empty($start_date_object) ? $start_date_object->getTimestamp() : '';
$end_date_object = DateTime::createFromFormat(get_option('date_format').' G:i', $meta['end_date'] . ' ' . $meta['end_time']);
$end_date = !empty($end_date_object) ? $end_date_object->getTimestamp() : '';
@sidharrell
sidharrell / gist:8811078
Created February 4, 2014 19:54
Add a price selector for the add new attendee in the admin
// unfortunately, the function does not currently have a pluggable function wrapper,
// so the best course of action right now is to add the pluggable function wrapper in core,
// then add the overriding function into a custom function holding location.
// so in includes/admin-reports/add_new_attendees.php add this as line 2:
if (!function_exists('add_new_attendee')) {
// then add the closing brace at the end of the file:
}
// that way, whenever the client updates and loses the custom functionality, all you need to do is
// add the pluggable function wrapper back in. And in a future update, we will probably add the
// pluggable function wrapper in.
@sidharrell
sidharrell / template.php
Last active August 29, 2015 13:56
Event Espresso invoice template including surcharge/VAT support. This file should go in your /wp-content/uploads/espresso/gateways/invoice directory.
<?php
/*Custom Log Function Include*/
// require('log.php');
/*End Custom Log Function Include*/
if (isset($_SESSION['espresso_session']['id'])) {
unset($_SESSION['espresso_session']['id']);
}
define('FPDF_FONTPATH', EVENT_ESPRESSO_PLUGINFULLPATH . 'class/fpdf/font/');
require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'class/fpdf/fpdf.php';
@sidharrell
sidharrell / gist:8925324
Created February 10, 2014 22:13
function to return display of all event times
function espresso_display_all_event_times($event_id) {
global $wpdb;
$sql = "SELECT ese.start_time, ese.end_time ";
$sql .= "FROM " . EVENTS_START_END_TABLE . " ese WHERE ese.event_id = %d";
$times = $wpdb->get_results($wpdb->prepare($sql, $event_id));
if(empty($times)) return NULL;
$time_format = get_option('time_format');
$output = "<p>";
foreach ($times as $time) {
$output .= "<span>" . event_date_display($time->start_time, $time_format) . " - " . event_date_display($time->end_time, $time_format) . "</span>";
@sidharrell
sidharrell / gist:8994796
Created February 14, 2014 02:30
add email newsletter filter (is being added in 3.1.38)
//this goes in includes/admin-files/event_newsletter.php at line 49 (approx)
<li>
<select name="filter">
<option value="all"><?php _e("All attendees of this event", "event_espresso"); ?></opton>
<option value="completed"><?php _e("Completed payment status attendees", "event_espresso"); ?></opton>
<option value="incomplete"><?php _e("Incomplete payment status attendees", "event_espresso"); ?></opton>
<option value="pending"><?php _e("Pending payment status attendees", "event_espresso"); ?></opton>
</select>
</li>