Skip to content

Instantly share code, notes, and snippets.

View Pebblo's full-sized avatar
🏠
Working from home

Tony Warwick Pebblo

🏠
Working from home
  • Event Espresso
  • Liverpool, UK
View GitHub Profile
@Pebblo
Pebblo / custom_functions.php
Last active December 23, 2015 10:19
Amendment of https://gist.github.com/Apina/5576163 to change the user role on specific event ID.
<?php //Please do not include the opening PHP tag
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'] );
@Pebblo
Pebblo / espresso_create_wp_user.php
Last active December 30, 2015 11:49 — forked from sethshoultes/espresso_create_wp_user.php
A function to create a new WP member using the registration details provided for the event, this function also adds the event they have just registered onto into the my events database so the initial events is displayed within 'My Events'
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
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 );
@Pebblo
Pebblo / event_list_attendees.php
Created December 12, 2013 12:22
Amended event_list_attendees.php file to include event date.
<?php
if (!defined('EVENT_ESPRESSO_VERSION')) {
exit('No direct script access allowed');
}
function event_list_attendees() {
global $wpdb, $org_options, $ticketing_installed, $espresso_premium;
require_once(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/event-management/queries.php');
require_once(EVENT_ESPRESSO_PLUGINFULLPATH . "includes/functions/attendee_functions.php");
@Pebblo
Pebblo / 0_reuse_code.js
Created April 2, 2014 22:13
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
@Pebblo
Pebblo / custom_functions.php
Last active August 29, 2015 14:02
Functions used to send emails when events are created or updated. Change lines 37 and 74 to the email address you wish to send the updates to.
<?php
function ee_event_created_email($params) {
global $wpdb;
$event_id = $params['event_id'];
if(empty($event_id)) {
return;
}
$sql = "SELECT evt.id, evt.event_name, evt.start_date, evt.end_date, se.start_time, se.end_time, v.name as venue_name, v.address, v.address2, v.city, v.state, v.zip FROM " . EVENTS_DETAIL_TABLE . " evt ";
@Pebblo
Pebblo / custom_functions.php
Created August 20, 2014 09:59
Set the default value for the 'Create a post' option within EE3. Place this within your themes functions.php, within wp-content/uploads/espresso/custom_functions.php or a site specific function. Requires 3.1.37+
<?php //Please do not include the opening PHP tag
add_filter('filter_hook_espresso_default_create_post_option', 'ee_return_create_post');
function ee_return_create_post(){
return 'Y';
}
?>
@Pebblo
Pebblo / custom_functions.php
Created August 20, 2014 10:14
Exclude attendee's that have been cancelled from the attendee reports by default in EE3. Requires 3.1.37+
<?php //Please do not include the opening PHP tag
function espresso_exclude_cancelled_payment_status() {
return ' AND a.payment_status != "Cancelled"';
}
add_filter('espresso_attendee_report_payment_status_where', 'espresso_exclude_cancelled_payment_status');
?>
@Pebblo
Pebblo / custom_functions.php
Created September 25, 2014 10:18
A functions to build the ticket list by first pulling the attendee's session_id from the DB, then grabbing all the attendee's within that session and looping through them. This is useful for MER registrations..
<?php //Please do not include the opening PHP tag if there is already one within the file that is still open.
function espresso_ticket_links_by_session($registration_id, $attendee_id, $multi_reg, $email = FALSE) {
global $wpdb;
$sql = "SELECT attendee_session FROM " . EVENTS_ATTENDEE_TABLE;
if (espresso_is_primary_attendee($attendee_id) != true) {
$sql .= " WHERE id = '" . $attendee_id . "' ";
} else {
$sql .= " WHERE registration_id = '" . $registration_id . "' ";
}
@Pebblo
Pebblo / ee_wp_mail_fix.php
Last active August 29, 2015 14:07
A fix for a conflict between WP-EMail and Event Espresso. Once the attendee entered their personal information on the registration page, WP-Email would re-direct the user to a share post form, this removes the action for registration pages. Add this to a site specific plugin or your themes functions.php file.
<?php //Please do not include the opening php tag if one is already open.
function ee_wp_mail_fix()
{
global $this_is_a_reg_page;
if($this_is_a_reg_page) {
remove_action('template_redirect', 'wp_email', 5);
}
}
add_action( 'template_redirect', 'ee_wp_mail_fix', 4 );
@Pebblo
Pebblo / functions.md
Last active November 18, 2015 16:43 — forked from joshfeck/template-parts.md
Alters the order of single event details to display the description -> datetimes -> ticket selector. Coded by Josh.