Skip to content

Instantly share code, notes, and snippets.

@Apina
Apina / estimatedreadtime
Last active August 29, 2015 13:58
Estimated Read Time plugin for WordPress
<?php
/*
Plugin Name: Estimated Read Time
Plugin URI: http://www.apinapress.com/
Description: Adds an estimated read time to posts (just above post content)
Version: 0.0.1
Author: Dean Robinson
Author URI: http://www.apinapress.com
License: GPL3
*/
@Apina
Apina / espresso_create_wp_user.php
Last active August 29, 2015 13:57 — forked from sethshoultes/espresso_create_wp_user.php
Swapped this to check for the email rather than username, and to dampen any errors due to duplicate username. The code can be added to the themes functions.php file though it is recommended to use a site specific plugin: http://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/
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'] ) == false ) {
global $org_options;
// Generate the password and create the user
$password = wp_generate_password( 12, false );
$user_id = wp_create_user( $attendee_data['fname'] . $attendee_data['lname'], $password, $attendee_data['email'] );
@Apina
Apina / registration_page.php
Created December 27, 2013 12:54
modified to display event description etc when event is maxed out, registration form is replaced with maxed out message
<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
do_action('action_hook_espresso_log', __FILE__, 'FILE LOADED', '');
//As of version 3.0.17
//This is a logic file for displaying a registration form for an event on a page. This file will do all of the backend data retrieval functions.
//There should be a copy of this file in your wp-content/uploads/espresso/ folder.
//Note: This entire function can be overridden using the "Custom Files" addon
if (!function_exists('register_attendees')) {
function register_attendees($single_event_id = NULL, $event_id_sc =0, $reg_form_only = false) {
//Declare the $data object
@Apina
Apina / espresso-calendar.php
Created December 20, 2013 08:33
Calendar set date parameter. Adds the new parameters custom_year and custom_month that will allow you to define what month/year the calendar begins on. Usage: [ESPRESSO_CALENDAR custom_year="2014" custom_month="9"] (BOTH PARAMETERS ARE REQUIRED!) ***IMPORTANT*** This needs to be added to the bottom of espresso_calendar.js just before the closing…
<?php
/*
Plugin Name: Event Espresso - Calendar
Plugin URI: http://www.eventespresso.com
Description: A full calendar addon for Event Espresso. Includes month, week, and day views.
Version: 2.1.p
Author: Event Espresso
Author URI: http://www.eventespresso.com
Copyright 2013 Event Espresso (email : [email protected])
@Apina
Apina / EE email attachment
Created December 16, 2013 09:04
Send an attachment with an EE email - change the attachment location. Add this to the custom files add on (custom_functions.php)
function event_espresso_send_email($params) {
global $org_options;
do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
extract($params);
//Define email headers
$headers = "";
if ($org_options['email_fancy_headers']=='Y') {
$headers .= "From: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n";
$headers .= "Reply-To: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n";
} else {
@Apina
Apina / event_registration_display.php
Created December 9, 2013 08:14
EE registration_page_display.php This modification is based off of the 3.1.36 version and allows the event description and times/prices etc to be seen when an event registration is closed, or not open yet and when the event has passed. Make sure that this file is copied to the wp-content/uploads/templates foldaer, and ALSO make sure that the reg…
<?php
//This is the registration form.
//This is a template file for displaying a registration form for an event on a page.
//There should be a copy of this file in your wp-content/uploads/espresso/ folder.
?>
<div id="espresso-event-id-<?php echo $event_id; ?>">
<div id="event_espresso_registration_form" class="event-display-boxes ui-widget">
<?php
$ui_corner = 'ui-corner-all';
//This tells the system to hide the event title if we only need to display the registration form.
@Apina
Apina / EE Custom Search
Last active December 30, 2015 00:09
EE Modified search this should be added to the Custom files addon (custom_shortcodes) as it is a separate shortcode It allows expired events to be disregarded from the search results
@Apina
Apina / EE ticket count modify
Created November 25, 2013 10:03
EE modify the ticket count
function change_ticket_count($attendee_data) {
if($attendee_data['event_id'] != '166') { return false;}
global $wpdb;
$wpdb->update( EVENTS_ATTENDEE_TABLE, array("quantity" => "5"), array("id" => $attendee_data['attendee_id']), array("%d"), array("%d") );
return;
}
add_action('action_hook_espresso_save_attendee_data', 'change_ticket_count');
@Apina
Apina / EE Remove gateways by event ID
Created November 15, 2013 07:57
Remove gateways by event ID Please note that if you want to do this with other gateways, you will need to check the action hook in each gateway as they may well be slightly different (e.g. invoice doesn't currently have the _2 at the end).
function htrappfae_remove_check_from_event($payment_data) {
extract( $payment_data );
if ( $event_id==8) { //check to see if this is the event with the ID of #8
//echo "Event Espresso ID: $event_id";
remove_action('action_hook_espresso_display_offline_payment_gateway_2','espresso_display_check' );
remove_action('action_hook_espresso_display_offline_payment_gateway_2', 'espresso_display_purchase_order');
}
}
add_action ( 'action_hook_espresso_display_offline_payment_gateway', 'htrappfae_remove_check_from_event',9 );
@Apina
Apina / EE set calendar date
Created July 15, 2013 09:50
EE set the calendar to show a specific date - this goes in the espresso-celendar.php file approx line 860. Note that month starts at 0 (zero) not 1, so code below is showing 21st March 2013
//this is just showing you where the code needs to go
if( ee_parentHeight < ee_newHeight ) {
ee_newHeight = ee_newHeight + 30;
dayCnt.parents('tr').height( ee_newHeight ).css({ 'height' : ee_newHeight + 'px' });
}
}
});