Skip to content

Instantly share code, notes, and snippets.

@joshfeck
joshfeck / remove_paypal.php
Created September 30, 2013 19:24
This will make it so that the PayPal button does not display when registering for a specific event. In this example, the event ID is 74. You'll need to swap in your event ID that you don't want the PayPal button to appear for.
<?php
function htrappfae_remove_paypal_from_event($payment_data) {
extract( $payment_data );
if ( $event_id==74 ) { //check to see if this is the event with the ID of #74
remove_action( 'action_hook_espresso_display_offsite_payment_gateway', 'espresso_display_paypal' );
}
}
add_action ( 'action_hook_espresso_display_offsite_payment_gateway', 'htrappfae_remove_paypal_from_event', 9 );
@sidharrell
sidharrell / gist:7087307
Last active December 26, 2015 03:39
for laggy paypal ipn messaging, set attendee payment status to "Pending"
// replaces line 24 of gateways/paypal/paypal_ipn.php
if (empty($_POST['ipn_track_id']) && ($_POST['payment_status'] == 'Completed' || $_POST['payment_status'] == 'Pending')) {
$payment_data['txn_details'] = serialize($_POST);
$payment_data['txn_id'] = $_POST['txn_id'];
$payment_data['payment_status'] = 'Pending';
} elseif ($myPaypal->validateIpn()) {
// replaces line 12 on gateways/paypal/init.php, to add the second line in
add_filter('filter_hook_espresso_transactions_get_payment_data', 'espresso_process_paypal');
add_filter('filter_hook_espresso_thank_you_get_payment_data', 'espresso_process_paypal');
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active November 15, 2024 16:37
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@joshfeck
joshfeck / attendee_list.php
Last active August 29, 2015 14:01
Displays an attendee list after the content on the event details page. Displays the gravatar, first name, and last name of each attendee registered for an event. Requires Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// prints a per event attendee list right after the event details on a single event page
// you can change the action hook that's on the next line to display the list in another location
add_action( 'AHEE_event_details_after_the_content', 'ee_attendee_list' );
function ee_attendee_list(){
global $wpdb, $post;
@joshfeck
joshfeck / example-query.php
Last active May 10, 2018 19:27
An example of a query that can be placed into a page template that displays a list of events for Event Espresso 4
<ul class="events">
<?php
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$atts = array(
'paged' => $paged,
'title' => NULL,
'limit' => 100,
'css_class' => NULL,
'show_expired' => FALSE,
'month' => NULL,
@joshfeck
joshfeck / add-to-function.pdf.php
Created June 3, 2014 16:58
This method can be added to the Espresso_PDF class in gateways/invoice/function.pdf.php to prepare some data to display the prices without the surcharge, and the surcharge amount as line items. Works with the Event Espresso 3.1.35.P or greater invoice template. Please see https://gist.github.com/joshfeck/e2b91cd6599000ecb772 for example template…
function my_itemised_surcharge($registration_ids, $attendees){
$options = get_option('events_organization_settings');
$currency = $options['currency_symbol'];
$this->SetFillColor(192,192,192);
// pull the selected ticket price breakdown from the database
global $wpdb, $org_options;
foreach( $registration_ids as $registration_id ) {
$price_query = "SELECT event_id, price_option FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id=%s";
@joshfeck
joshfeck / add-to-template.php
Created June 3, 2014 17:00
This gist works in conjunction with https://gist.github.com/joshfeck/52ac749150322a2e4221. 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($registration_ids, $attendees);
@lorenzocaum
lorenzocaum / gist:848801a1173be464fbe7
Last active January 30, 2017 00:36
Enable WordPress debugging with debug log on and debug display on
<?php
//* Do NOT include the opening php tag
//* Enable WordPress debugging with debug log and debug display
define('WP_DEBUG', true);
if (WP_DEBUG) {
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);
}
@joshfeck
joshfeck / functions.php
Last active January 21, 2021 22:43
Event Espresso 4.2 and 4.3 capability filter examples. Thread: http://eventespresso.com/topic/ee4-creating-a-role-to-just-manage-espresso-events/
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// give user roles that can 'publish_posts' access to events, registrations, transactions, registration forms
// roles will also need 'manage_options' cap
add_filter ('FHEE_management_capability', 'my_custom_menu_management_capability');
function my_custom_menu_management_capability() {
return 'publish_posts';
@joshfeck
joshfeck / template-parts.md
Last active November 18, 2015 16:19
This moves the ticket selector from before the event content to after the event content. Requires Event Espresso 4.8.24.p or greater.