Skip to content

Instantly share code, notes, and snippets.

View lorenzocaum's full-sized avatar

Lorenzo Orlando Caum lorenzocaum

View GitHub Profile
<?php
/**
* Plugin Name: EDD Heartbeat API test plugin
* Description: Demonstrates how to use the Heartbeat API to update the payments count on the dashboard
*/
// Load the heartbeat JS
function edd_heartbeat_enqueue( $hook_suffix ) {
// Make sure the JS part of the Heartbeat API is loaded.
wp_enqueue_script( 'heartbeat' );
@amdrew
amdrew / gist:7181379
Last active February 27, 2016 18:24
Modify the "return to website" text on the PayPal confirmation page, when customer is sent from Easy Digital Downloads. The default text is your site title
<?php
function my_child_theme_edd_paypal_redirect_args( $paypal_args ) {
$paypal_args['cbt'] = 'Return to our site to complete your purchase';
return $paypal_args;
}
add_filter( 'edd_paypal_redirect_args', 'my_child_theme_edd_paypal_redirect_args' );
@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 );
@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'] );
@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 / add-to-functions.php
Last active June 23, 2017 20:53
Add this to your WordPress website's custom functions plugin to make it so the return from PayPal page is https. Required: Event Espresso 4 and an SSL certificate installed for your domain.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter('_get_page_link','ee_paypal_return_https',10,2);
function ee_paypal_return_https($original_url,$post_id){
if (class_exists('EE_Registry')){
if(EE_Registry::instance()->CFG->core->thank_you_page_id == $post_id){
$original_url = str_replace("http://","https://",$original_url);
}
#edd-gateway-option-paypal:before {
content: url('../../../plugins/easy-digital-downloads/assets/images/icons/paypal.png');
position: relative;
left: -10px;
top: 10px;
}
#edd-gateway-option-manual:before {
content: url('../../../plugins/easy-digital-downloads/assets/images/icons/visa.png');
position: relative;
@amdrew
amdrew / gist:40fcef36a7842d80f66c
Last active July 13, 2023 00:30
EDD 2.0 - Show discount field by default
<?php
/**
* Unhook default EDD discount field
*/
remove_action( 'edd_checkout_form_top', 'edd_discount_field', -1 );
/**
* Add our own callback for the discount field, keeping the same CSS as before
*/
@joshfeck
joshfeck / payment-settings-fixer.php
Created July 22, 2014 01:18
This can be installed as a plugin or if you have a site specific plugin already installed you can copy the add_action and the callback function to your plugin.
<?php
/**
* @package Payment Settings Fixer
* @version 0.1
*/
/*
Plugin Name: Payment Settings Fixer
Plugin URI: https://github.com/joshfeck
Description: A little patch to fix a strange issue in some WPEngine sites' admin for the Event Espresso 3 Payment settings page
Author: Josh Feck
@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.