Skip to content

Instantly share code, notes, and snippets.

Pippin Williamson pippinsplugins

Block or report user

Report or block pippinsplugins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View edd-heartbeat-demo.php
<?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' );
View gist:9641841
<?php
function get_the_user_ip() {
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
//check ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
//to check ip is pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
@pippinsplugins
pippinsplugins / edd_email_conf.php
Last active Dec 17, 2019
Add email confirmation to EDD
View edd_email_conf.php
<?php
function pw_edd_add_email_confirmation() {
?>
<p>
<label class="edd-label" for="edd-email-confirm">
<?php _e('Confirm Your Email Address', 'easy-digital-downloads'); ?>
<span class="edd-required-indicator">*</span>
</label>
<span class="edd-description" id="edd-email-description"><?php esc_html_e( 'Please confirm your email address.', 'easy-digital-downloads' ); ?></span>
@pippinsplugins
pippinsplugins / edd-commission-update.php
Created Jul 21, 2015
Bulk set EDD Commissions to "unpaid" for all commissions after a specific date
View edd-commission-update.php
<?php
$commissions = get_posts( array(
'post_type' => 'edd_commission',
'posts_per_page' => -1,
'fields' => 'ids',
'date_query' => array(
'after' => array(
'year' => 2015,
'month' => 03,
'day' => 15
@pippinsplugins
pippinsplugins / Warn when saving any EDD payment
Last active Apr 25, 2019 — forked from mintplugins/Warn when saving any EDD payment
Just a quick sample to demonstrate how you could approach asking "Are you sure" when saving a payment
View Warn when saving any EDD payment
function custom_prefix_warn_about_old_refunds_js() {
if ( ! isset( $_GET['prevent_accidental_refunds_js'] ) ) {
return false;
}
header('Content-Type: application/javascript');
?>
@pippinsplugins
pippinsplugins / gist:ececad5d57e3946c5af3
Last active Apr 22, 2019
Adds billing address fields to Restrict Content Pro
View gist:ececad5d57e3946c5af3
<?php
/**
* Plugin Name: Restrict Content Pro - Collect Billing Address
* Description: Collect customers billing address during registration through Restrict Content Pro
* Author: Pippin Williamson
* Version: 1.0
*/
class RCP_Billing_Address {
@pippinsplugins
pippinsplugins / EDD Add to Cart Checkout
Created Sep 8, 2012 — forked from bryceadams/EDD Add to Cart + Checkout
Easy Digital Downloads - Add to Cart and redirect to Checkout Page
View EDD Add to Cart Checkout
<a href="<?php echo add_query_arg( array( 'edd_action' => 'add_to_cart', 'download_id' => get_the_ID() ), edd_get_checkout_uri() ); ?>">Add to Cart</a>
@pippinsplugins
pippinsplugins / gist:d973776836ab984aea06
Created Sep 3, 2014
Sets an affiliate user's role to a specific role when being added as an affiliate
View gist:d973776836ab984aea06
<?php
/*
* Plugin name: Affiliate role on registration
*/
function pw_affwp_set_role_on_registration( $affiliate_id = 0 ) {
$user_id = affwp_get_affiliate_user_id( $affiliate_id );
$user = new WP_User( $user_id );
$user->add_role( 'affiliate' );
@pippinsplugins
pippinsplugins / gist:3c1fe20e6abb04a2e85d
Created Oct 10, 2014
Make the first name not required during EDD checkout
View gist:3c1fe20e6abb04a2e85d
<?php
function pw_edd_purchase_form_required_fields( $required_fields ) {
unset( $required_fields['edd_first'] );
return $required_fields;
}
add_filter( 'edd_purchase_form_required_fields', 'pw_edd_purchase_form_required_fields' );
View edd-custom-fields.php
<?php
/*
* Plugin Name: Custom EDD Checkout Fields
*/
// output our custom field HTML
function pippin_edd_custom_checkout_fields() {
?>
<p id="edd-phone-wrap">
<label class="edd-label" for="edd-phone"><?php _e('Telephone Number', 'pippin_edd'); ?><span class="edd-required-indicator">*</span></label>
You can’t perform that action at this time.