Skip to content

Instantly share code, notes, and snippets.

<?php
// Options
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
// Load Venue View Helper
EE_Registry::instance()->load_helper('Venue_View');
//Defaults
$reg_button_text = !isset($reg_button_text) ? __('Register', 'event_espresso') : $reg_button_text;
$alt_button_text = !isset($alt_button_text) ? __('View Details', 'event_espresso') : $alt_button_text;//For alternate registration pages
$sold_out_button_text = !isset($sold_out_button_text) ? __('Sold Out', 'event_espresso') : $sold_out_button_text;//For sold out events
@joshfeck
joshfeck / example.php
Last active August 3, 2018 22:52 — forked from Pebblo/example-multiple-caps.php
Example of how to dynamically remove the current registrations ticket capability (if set) from the current user.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action(
'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
'my_remove_one_time_invitation_from_user',
10,
2
);
function my_remove_one_time_invitation_from_user(
$registration,
@joshfeck
joshfeck / ee_display_download_tickets.php
Last active June 20, 2018 15:15 — forked from Pebblo/ee_display_download_tickets.php
Add a 'Download your tickets' button & the QR code to the EE4 thank you page. The hook in use adds the button & QR code before the overview, just after the confirmation order section. You will likely need to apply your own styles, possibly a container div and apply styles to that depending on how you want this to be displayed.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_display_download_tickets( $transaction ) {
if ( $transaction instanceof EE_Transaction ) {
$primary_reg = $transaction->primary_registration();
if ( $primary_reg->is_approved() ) {
@joshfeck
joshfeck / csv_transaction.php
Last active February 8, 2018 22:09 — forked from Pebblo/csv_transaction.php
add a column to the Event Espresso 4 Registrations CSV report that displays the total tax amount for the transaction
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'espresso_add_total_taxes_column', 10, 2);
function espresso_add_total_taxes_column( $reg_csv_array, $reg_row ) {
$registration = EEM_Registration::instance()->get_one_by_ID( $reg_row['Registration.REG_ID'] );
$sub_line_item_details = array();
if( $registration instanceof EE_Registration && $registration->is_primary_registrant() ) {
$sub_line_items = EEM_Line_Item::instance()->get_all(
array(
@joshfeck
joshfeck / functions.php
Last active October 16, 2017 03:29 — forked from Pebblo/functions.php
Add a ninja form to a Sold out Event Espresso 4 event. This is useful if you want to capture names and contact info from people that want to be signed up for a waiting list.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// Display a contact form when the event is sold out
// to be used as a waiting list
function ee_espresso_clean_event_status( $event ) {
$status = $event instanceof EE_Event ? $event->get_active_status() : 'inactive';
return $status;
}
@joshfeck
joshfeck / example.php
Last active February 2, 2017 01:35 — forked from Pebblo/example.php
How to filter the 'Event Cart' text to use something else in its place, in this example just 'Cart'
<?php //Please do not include the opening PHP tag if you already have one.
function tw_ee_return_cart() {
return 'Cart';
}
add_filter( 'FHEE__EED_Multi_Event_Registration__set_definitions__event_cart_name', 'tw_ee_return_cart' );
// also filter the empty cart message:
function my_ee_cart_is_empty() {
@joshfeck
joshfeck / add_location_to_calendar_event.php
Created January 19, 2017 22:00
Adds the event location to the EE4 calendar event. Requires EE4.
function jv_ee_add_location_to_calendar_event( $text, $datetime, $event ) {
if ( $event instanceof EE_Event ) {
$venue = $event->get_first_related( 'Venue' );
if ( $venue instanceof EE_Venue ) {
$venue_name = $venue->name();
$text .= '<span>Location: ' . $venue_name . '</span>';
}
}
return $text;
}
@joshfeck
joshfeck / next-previous.php
Last active October 18, 2016 15:25 — forked from lorenzocaum/new_gist_file.md
Add a previous event and next event link to the end of the single event pages in Event Espresso 4
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
//* Add a previous event and next event link to single event pages in Event Espresso 4
function ee_previous_event_next_event_navigation(){
?>
<div class="ee-after-event-navigation ee-clearfix">
<div class="ee-after-event-navigation-previous" style="float:left"><?php previous_post_link('&laquo; %link', 'Previous Event: %title'); ?></div>
<div class="ee-after-event-navigation-next" style="float:right"><?php next_post_link('%link &raquo; ', 'Next Event: %title'); ?></div>
</div>
<?php
/*
Plugin Name: Custom Post Type Plugin
Description: Properties Custom Post Type.
*/
/*
* Creating a function to create our CPT
*/
@joshfeck
joshfeck / espresso_create_wp_user.php
Last active August 29, 2015 14:08 — forked from Pebblo/espresso_create_wp_user.php
Adds a new user account and sends a new user email after registering for an event. Requires EE3 and its WP user integration add-on.
<?php
add_action('action_hook_espresso_save_attendee_data','espresso_create_wp_user', 10, 1);
function espresso_create_wp_user($attendee_data) {
if( email_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'] );