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: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: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: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: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: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: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:8461296
Created January 16, 2014 19:09
edit attendee links on payment overview.php
<tr>
<?php
$attendees = $wpdb->get_results($wpdb->prepare("SELECT registration_id, id, event_id, fname, lname FROM ".EVENTS_ATTENDEE_TABLE." WHERE attendee_session=%s", $attendee_session), OBJECT);
foreach ($attendees as $attendee) {
echo espresso_edit_attendee($attendee->registration_id, $attendee->id, $attendee->event_id, 'attendee', sprintf(__('Edit Registration Details for %s, %s','event_espresso'), $attendee->lname, $attendee->fname)); ?><br/>
<?php } ?>
</tr>
// Not sure why it jumps out of the table to above it.
@sidharrell
sidharrell / gist:8343222
Created January 9, 2014 22:24
conditional questions jQuery hack
<script>
jQuery( document ).ready( function() {
jQuery('.DROPDOWN_37').html('');
jQuery('.DROPDOWN_36').on('change', function() {
switch(jQuery(this).val()) {
case '1':
jQuery('.DROPDOWN_37').html('<option value="">Select One</option><option value="1"> 1</option><option value="2"> 2</option><option value="3"> 3</option>');
break;
case '2':
jQuery('.DROPDOWN_37').html('<option value="">Select One</option><option value="4"> 4</option><option value="5"> 5</option><option value="6"> 6</option>');
@sidharrell
sidharrell / gist:8203590
Created January 1, 2014 00:20
custom function to make price_option available in payment_overview.php template
function espresso_prepare_payment_data_for_gateways_custom( $payment_data ) {
remove_filter('filter_hook_espresso_prepare_payment_data_for_gateways', 'espresso_prepare_payment_data_for_gateways');
global $wpdb, $org_options;
$SQL = "SELECT ea.price_option, ea.email, ea.event_id, ea.registration_id, ea.txn_type, ed.start_date,";
$SQL .= " ea.attendee_session, ed.event_name, ea.lname, ea.fname, ea.total_cost,";
$SQL .= " ea.payment_status, ea.payment_date, ea.address, ea.city, ea.txn_id,";
$SQL .= " ea.zip, ea.state, ea.phone, ed.event_meta FROM " . EVENTS_ATTENDEE_TABLE . " ea";
$SQL .= " JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=ea.event_id";
$SQL .= " WHERE ea.id = %d";
$temp_data = $wpdb->get_row( $wpdb->prepare( $SQL, $payment_data['attendee_id'] ), ARRAY_A );
@sidharrell
sidharrell / gist:8193255
Created December 31, 2013 06:09
fix for attednee_numbers shortcode to make it work independent of specific event id (REM)
function espresso_attendees_data_sc($atts) {
global $wpdb, $org_options, $this_event_id;
extract(shortcode_atts(array('event_id' => $this_event_id, 'type' => ''), $atts));
$event_id = "{$event_id}";
$type = "{$type}";
$data = get_number_of_attendees_reg_limit($event_id, $type);
return $data;
}