This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // replaces lines 183-192 of includes/functions/time_date.php: | |
| $SQL .= "( SELECT COALESCE( (SELECT sum(quantity) FROM " . EVENTS_ATTENDEE_TABLE . " ATT "; | |
| $SQL .= "WHERE ATT.event_id= %d "; | |
| $SQL .= "AND ATT.payment_status != 'Incomplete' "; | |
| $SQL .= "AND ATT.event_time = ESE.start_time "; | |
| $SQL .= "AND ATT.end_time = ESE.end_time), 0 ) ) "; | |
| $SQL .= ") AS available_spaces "; | |
| $SQL .= "FROM " . EVENTS_START_END_TABLE . " ESE "; | |
| $SQL .= "WHERE ESE.event_id= %d "; | |
| $SQL .= "GROUP BY ESE.id "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function espresso_update_attendee_payment_status_in_db_custom($payment_data) { | |
| // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; | |
| remove_filter('filter_hook_espresso_update_attendee_payment_data_in_db', 'espresso_update_attendee_payment_status_in_db'); | |
| global $wpdb; | |
| $payment_data['payment_date'] = date(get_option('date_format')); | |
| if ($payment_data['payment_status'] == "Completed") { | |
| $payment = $payment_data['total_cost']; | |
| } elseif($payment_data['payment_status'] == "Pending" && !empty($payment_data['amount_paid'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //replaces lines 24-43 of plugins/espresso-multiple/cart-widget.php | |
| public function widget($args, $instance) { | |
| //if (empty($_SESSION['espresso_session']['events_in_session'])){return;} | |
| extract($args); | |
| global $org_options; | |
| $grand_total = !empty($_SESSION['espresso_session']['grand_total']) ? $_SESSION['espresso_session']['grand_total'] : 0.00; | |
| $title = apply_filters('widget_title', $instance['title']); | |
| echo $before_widget; | |
| echo $before_title . $title . $after_title; | |
| //Debug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function espresso_count_the_events_in_a_category ($atts) { | |
| extract(shortcode_atts(array('event_category_id' => FALSE), $atts)); | |
| if (!$event_category_id) return FALSE; | |
| global $wpdb; | |
| return $wpdb->get_var($wpdb->prepare("SELECT COUNT(ed.id) FROM " . EVENTS_DETAIL_TABLE . " ed JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON ed.id = cr.event_id JOIN " . EVENTS_CATEGORY_TABLE . " cd ON cr.cat_id = cd.id WHERE cd.category_identifier = '%s' AND ed.event_status != 'D'", $event_category_id)); | |
| } | |
| add_shortcode('COUNT_EVENTS_IN_CATEGORY', 'espresso_count_the_events_in_a_category'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // replaces gateways/eway/ewaypaymentprocess.php lines 87-97 | |
| if ($eway_settings['use_sandbox']) { | |
| echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('Debugging / Sandbox output', 'event_espresso') . '</h3><br />'; | |
| echo "Response code = " . $responsecode; | |
| echo "\nResponse = "; | |
| var_dump($response); | |
| echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('End of Debugging / Sandbox output (this will go away when you switch to live transactions)', 'event_espresso') . '</h3>'; | |
| $subject = 'Instant Payment Notification - Gateway Variable Dump'; | |
| $body = "An instant payment notification failed\n"; | |
| $body .= "from " . " on " . date('m/d/Y'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function espresso_return_single_price_sans_surcharge($event_id, $number=0) { | |
| do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); | |
| global $wpdb, $org_options; | |
| $number = $number == 0 ? '0,1' : $number . ',' . $number; | |
| $results = $wpdb->get_results("SELECT event_cost FROM " . EVENTS_PRICES_TABLE . " WHERE event_id='" . $event_id . "' ORDER BY id ASC LIMIT " . $number); | |
| if ($wpdb->num_rows > 0) { | |
| foreach ($results as $result) { | |
| $event_cost = $result->event_cost; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function espresso_ticket_dd($current_value = 0){ | |
| if ($current_value == 0) | |
| $current_value = 2; // Change this to the id of the ticket that you would like to be the default ticket. | |
| global $espresso_premium; if ($espresso_premium != true) return; | |
| global $wpdb; | |
| $sql = "SELECT id, ticket_name FROM " .EVENTS_TICKET_TEMPLATES; | |
| $sql .= " WHERE ticket_name != '' ORDER BY ticket_name "; | |
| //echo $sql; | |
| $tickets = $wpdb->get_results($sql); | |
| $num_rows = $wpdb->num_rows; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('action_hook_espresso_save_attendee_data','espresso_create_wp_user', 10, 1); | |
| function espresso_create_wp_user($attendee_data) { | |
| if( username_exists( $attendee_data['email'] ) == NULL ) { | |
| global $org_options; | |
| // Generate the password and create the user | |
| $password = wp_generate_password( 12, false ); | |
| $user_id = wp_create_user( $attendee_data['email'], $password, $attendee_data['email'] ); | |
| // Set the users details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function espresso_prepare_event_link_fixed ($payment_data) { | |
| global $wpdb; | |
| remove_filter('filter_hook_espresso_prepare_event_link', 'espresso_prepare_event_link'); | |
| $sql = "SELECT ea.event_id, ed.event_name, ed.externalURL FROM " . EVENTS_ATTENDEE_TABLE . " ea"; | |
| $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " ed ON ed.id=ea.event_id"; | |
| $sql .= " WHERE ea.attendee_session='" . $payment_data['attendee_session'] . "'"; | |
| $events = $wpdb->get_results($sql, OBJECT_K); | |
| $payment_data['event_link'] = ''; | |
| foreach ($events as $event) { | |
| if (empty($event->externalURL)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function apply_coupon_to_primary_attendee_only ($ext_att_data_source) { | |
| global $wpdb; | |
| $attendee = $wpdb->get_row('SELECT * FROM ' . EVENTS_ATTENDEE_TABLE . ' WHERE id=' . $ext_att_data_source['attendee_id'], ARRAY_A); | |
| if ($attendee['is_primary'] != 1) { | |
| $wpdb->update(EVENTS_ATTENDEE_TABLE, | |
| array('final_price'=>$attendee['orig_price']), | |
| array('id'=>$attendee['id']), | |
| array('%f'), | |
| array('%d')); | |
| } |