Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sethshoultes
sethshoultes / my_events_page.php
Last active December 11, 2015 10:29
Add an invoice link to Event Espresso WP User Integration addon version 1.9.7 and below. This is will be added in the WP User Integration addon version 1.9.8 and was requested in this forum post: http://eventespresso.com/topic/add-an-invoice-link-to-the-my-events-page/#post-31994
<?php
if (!function_exists('event_espresso_my_events')) {
function event_espresso_my_events(){
global $espresso_premium; if ($espresso_premium != true) return;
global $wpdb, $org_options;
global $ticketing_installed;
//$wpdb->show_errors();
require_once('user_vars.php');
?>
@sethshoultes
sethshoultes / event_list.php
Created February 4, 2013 07:10
When we added the feature to use multiple categories in the EVENT_LIST short code, we lost/broke existing categories because they are stored in a different table. With the added support for multiple categories, we started storing a comma separated list of category ids in the events_detail table. So I am adding support for the legacy and new cate…
<?php
//This is a template file for displaying a list of events on a page. These functions are used with the [ESPRESSO_EVENTS] shortcode.
//This is an group of functions for querying all of the events in your databse.
//This file should be stored in your "/wp-content/uploads/espresso/templates/" directory.
//Note: All of these functions can be overridden using the "Custom Files" addon. The custom files addon also contains sample code to display ongoing events
if (!function_exists('display_all_events')) {
function display_all_events() {
event_espresso_get_event_details(array());
@sethshoultes
sethshoultes / espresso_create_wp_user.php
Last active February 16, 2016 16:58
This action creates a WordPress user when someone registers for your an event. It uses the email address of the registrant to create the user name and the password is randomly generated. Add this function and action to your theme/functions.php file. More info in the comments below.
<?php
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'] );
function mycustom_filter_gettext( $translated, $original, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
'Register' => 'Sign up',
'Confirm and go to payment page' => 'Complete registration',
// Add some more strings here
);
@sethshoultes
sethshoultes / 0_reuse_code.js
Created April 2, 2014 22:59
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
case 'PENDING':
if (current_user_can('administrator') || function_exists('espresso_member_data') && espresso_can_view_event($event_id) == true) {
?>
<li class="pending_event"><a href="<?php echo $registration_url; ?>"><?php echo stripslashes_deep($event->event_name) ?> - <span class="widget-event-date"><?php echo event_date_display($event->start_date) ?></span></a>
<?php
}
break;
@sethshoultes
sethshoultes / template-parts.md
Last active November 18, 2015 17:52 — forked from Pebblo/functions.md
This moves the ticket selector from before the event content to after the event content. Requires Event Espresso 4.8.24.p or greater.
@sethshoultes
sethshoultes / HelpScout Docs Customization
Last active August 29, 2015 14:14 — forked from seedprod/gist:7de2027ad32e1a5ee8d9
Adds new buttons to HelpScout Docs
<!-- Replace default Contact Us url in HelpScout Docs with custom url and add a My Account link to the top menu -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(function() {
$("#contact a,#sbContact,#sbContactMobile, #contactMobile a").attr("href", "https://app.sellwp.co/seedprod/ticket").text('Open a Ticket');
$( "#mainNav .nav" ).append( "<li><a href='http://www.seedprod.com/members'>My Account</a></li>" );
});
</script>
<!-- SeedProd.com custom styles -->
@sethshoultes
sethshoultes / ee_password_post_filter.php
Created May 15, 2015 16:33
Exclude password protected events and posts from the WordPress loop. Adapted from Stackoverflow: http://stackoverflow.com/questions/7538959/how-to-exclude-password-protected-posts-in-wordpress-loop
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// Create a new filtering function that will add our where clause to the query
function ee_password_post_filter( $where = '' ) {
// Make sure this only applies to loops / feeds on the frontend
if (!is_single() && !is_admin()) {
// exclude password protected
$where .= " AND post_password = ''";
}
@sethshoultes
sethshoultes / ee_display_download_tickets.php
Created February 12, 2016 17:53 — forked from Pebblo/ee_display_download_tickets.php
Add a 'Download your tickets' button to the EE4 thank you page. The hook in use adds the button above the overview, just under 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() ) {