Skip to content

Instantly share code, notes, and snippets.

View eighty20results's full-sized avatar

Thomas Sjølshagen eighty20results

View GitHub Profile
@eighty20results
eighty20results / pmpro-canadian-tax-option.php
Last active January 16, 2018 20:24
Canadian Tax calculation for PMPro (HST, PST, TPS and TVQ rates)
<?php
/*
Plugin Name: PMPro: Canadian Tax calculation
Plugin URI: https://eighty20resultsc.com/wordpress-plugins/
Description: PMPro Tax Calculation for (some of) the Canadian province(s)
Version: 1.4
Author: Thomas Sjolshagen @ Paid Memberships Pro <thomas@eighy20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
License: GPL2
@eighty20results
eighty20results / unique_line_items.php
Last active November 21, 2017 07:26
Add a new line item if the quantity of a product increases
function createUniqueLineItems( $cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data ) {
// Only do this for quantities > 1
if ( $quantity > 1 ) {
// Reset the quantity for the current product entry
WC()->cart->set_quantity( $cart_item_key, 1 );
// Add a line-item for all quantities > 1. Already have one entry in the cart, so do it for $quantity - 1
for ( $i = 1; $i <= $quantity - 1; $i ++ ) {
@eighty20results
eighty20results / pmpro-australian-gst.php
Last active November 6, 2017 01:27
Calculate GST for Australian billing addresses/residents
<?php
/**
* Plugin Name: Paid Memberships Pro - Australian GST
* Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
* Description: Calculate and display GST for Australian customers at checkout
* Version: 1.0
* Author: Paid Memberships Pro / Thomas Sjolshagen <thomas@eighty20results.com>
* Author URI: https://eighty20results.com/thomas-sjolshagen/
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* License: GPLv2 or later
<?php
/*
Plugin Name: PMPro Customizations: Register Helper Fields
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
Description: Customizations - Register Helper Fields
Version: 1.0
Author: Eighty / 20 Results by Wicked Strong Chicks, LLC <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
License: GPLv2 or later
@eighty20results
eighty20results / aja-pmpro-customizations.php
Created August 23, 2017 21:49
Customization: Prorated Expiring membership for @ajac036
<?php
/*
Plugin Name: PMPro Customizations: Membership proration
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
Description: Prorate price for Level ID 5 memberships based on month of the year when the user signs up
Version: 1.0
Author: Eighty / 20 Results by Wicked Strong Chicks, LLC <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
License: GPLv2 or later
@eighty20results
eighty20results / pmpro-custom-advanced-messages.php
Created August 22, 2017 00:46
Access denied messages for RSS feeds and Non Member users. Custom message based on the membership level the user _does_ have
<?php
/**
* Plugin Name: Paid Memberships Pro - Custom Advanced Settings Messages
* Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
* Description: Per membership level message for the membership/login required
* Version: 1.0
* Author: Paid Memberships Pro / Thomas Sjolshagen <thomas@eighty20results.com>
* Author URI: https://eighty20results.com/thomas-sjolshagen/
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* License: GPLv2 or later
@eighty20results
eighty20results / ic-customizations.php
Created June 8, 2017 21:42
Customizations to use the "Capture Name & Address for Free Levels or for Offsite Gateway" add-on
<?php
/*
Plugin Name: PMPro Customizations: Required Field Changes
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
Description: Customizations to disable required fields for some of the Address/Addon.
Version: 1.0
Author: Eighty / 20 Results by Wicked Strong Chicks, LLC <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
License: GPLv2 or later
@eighty20results
eighty20results / sn-customizations.php
Created May 23, 2017 23:03
Custom Fields (Register Helper)
<?php
/*
Plugin Name: PMPro: Custom Registration/WordPress Profile Fields
Description: Custom fields, using the PMPro Register Helper add-on
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
Author: Thomas Sjolshagen @ Paid Memberships Pro <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
Version: 1.0
License: GPL2
Text Domain: sn-customizations
@eighty20results
eighty20results / e20r-disabled-domains.php
Created March 31, 2017 17:51
Disallow certain email domains from creating membership(s)
<?php
/*
Plugin Name: PMPro e-mail domain check
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Check if a domain is on the "do not allow" list for registration
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@eighty20results
eighty20results / order-records-example.php
Created February 2, 2017 00:21
Sample check of order records for a user
<?php
global $wpdb;
$records = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->pmpro_membership_orders} WHERE user_id = %d AND status = %s", $user_id, 'success' ) );
if ( $records == 1 ) {
// No previous order found
} else {
// Found old orders so member is not new
}