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:9012261
Created February 15, 2014 00:09
improved attendee report with totals
function espresso_chart_display($event_id, $type){
global $wpdb, $org_options;
$retVAl = array();
switch ($type){
case 'total_reg':
//Total Registrations/Transactions
$title = __('Total Registrations/Transactions', 'event_espresso');
$sql = "SELECT SUM(a.total_cost) amount, SUM(a.quantity) quantity, DATE_FORMAT(a.date,'%b %d') date FROM ".EVENTS_ATTENDEE_TABLE." a WHERE event_id =".$event_id." GROUP BY DATE_FORMAT(a.date,'%m-%d-%Y')";
$sql2 = "SELECT SUM(a.total_cost) amount, SUM(a.quantity) quantity, 'total' as date FROM ".EVENTS_ATTENDEE_TABLE." a WHERE event_id =".$event_id;
break;
@sidharrell
sidharrell / gist:9129062
Created February 21, 2014 05:02
select box card type
// insert at line 70 of gateways/aim/aim_vars.php
// copy aim folder from plugins/event-espresso/gateways to uploads/espresso/gateways first
<p>
<label for="card-type">Card Card Type</label>
<select id="ppp_card-type" name="creditcardtype" class="wide required">
<option value="Visa">Visa</option><option value="MasterCard">MasterCard</option><option value="Discover">Discover</option>
</select>
</p>
@sidharrell
sidharrell / gist:9194830
Last active August 29, 2015 13:56
override ESPRESSO_REG_FORM shortcode function as patch to no price, time selector on CPT single event template
function espresso_reg_form_sc($atts) {
wp_enqueue_script('validation'); //This tells the plugin to load the required scripts
extract(shortcode_atts(array('event_id' => '0'), $atts));
$event_id = "{$event_id}";
ob_start();
register_attendees(NULL, $event_id, false);
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
@sidharrell
sidharrell / gist:9280456
Created February 28, 2014 21:38
add featured image support to event posts
// in includes/event-management/insert_event.php, put this in after
// $post_id = wp_insert_post($my_post);
// which is line 508 in 3.1.36.4.P
$event_thumbnail_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM $wpdb->posts WHERE guid = '%s'", $event_thumbnail_url));
if (!empty($event_thumbnail_id)) {
$wpdb->update( $wpdb->posts, array('post_parent' => $post_id), array('id' => $event_thumbnail_id));
add_post_meta($post_id, '_thumbnail_id', $event_thumbnail_id);
}
// and in includes/event-management/update_event.php, put this in after
@sidharrell
sidharrell / gist:8f1ce590f7717fd6e905
Created May 26, 2014 18:37
EE4 Modified template content-espresso_events-datetimes.php
<?php
//echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' &nbsp; <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>';
if ( is_single() || is_archive() && espresso_display_datetimes_in_event_list() ) :
global $post;
do_action( 'AHEE_event_details_before_event_date', $post );
?>
<div class="event-datetimes">
<h3 class="event-datetimes-h3 ee-event-h3">
<span class="dashicons dashicons-calendar"></span><?php _e( 'Upcoming Date(s) and Time(s)', 'event_espresso' ); ?>
@sidharrell
sidharrell / gist:e717c2efb5fa271fa1cb
Created June 9, 2014 17:49
function to return prices for event
function espresso_return_prices_for_event ( $event_id ) {
global $wpdb;
return $wpdb->get_results($wpdb->prepare( "SELECT * FROM " . EVENTS_PRICES_TABLE . " WHERE event_id = %d" , $event_id ));
}
@sidharrell
sidharrell / gist:9de33f19f6f98794fe29
Created June 9, 2014 18:48
fix for espresso-custom-templates/templates/events-table/index.php
// replaces lines 87-93
if ($event_status == 'NOT_ACTIVE') {
$live_button = __('Closed', 'event_espresso');
$cart_link = '';
}
if ( !empty( $event->category_id ) ) {
$array_cat=explode(",",$event->category_id);
$cat=array_map(function($val) { return "cat-" . trim($val); }, $array_cat);
$cat_class = implode(" ", $cat);
@sidharrell
sidharrell / 0_reuse_code.js
Created June 12, 2014 01:08
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
@sidharrell
sidharrell / gist:6ede29557dd068eefeb2
Last active November 30, 2016 22:01
EE4 override espresso_list_of_event_dates
function espresso_list_of_event_dates( $EVT_ID = FALSE, $dt_frmt = '', $tm_frmt = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE ) {
$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : get_option('date_format');
$tm_frmt = ! empty( $tm_frmt ) ? $tm_frmt : get_option('time_format');
$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID ,$show_expired );
//d( $datetimes );
if ( is_array( $datetimes ) && ! empty( $datetimes )) {
global $post;
$html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul">' : '';
foreach ( $datetimes as $datetime ) {
if ( $datetime instanceof EE_Datetime ) {
@sidharrell
sidharrell / gist:f4aa5491ec2cd0db09c1
Created June 30, 2014 23:33
replacement for EE3 includes/event-management/csv_import.php in 3.1.36
<?php
function csv_import() { ?>
<h3>Event Import</h3>
<ul>
<li>
<p><?php _e('This page is for importing your events from a comma separated file (CSV) directly into the the events database. The limitation of this upload is that it does not support the extra questions, only the core event configuration.', 'event_espresso'); ?> </p>
<ul>
<li><?php _e('Please use Y where you want to say Yes and N where you want No.', 'event_espresso'); ?></li>
<li><?php _e('Dates should be formatted YYYY-MM-DD (2009-07-04).', 'event_espresso'); ?></li>