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_cancel_on_next_payments_date.php
Last active July 17, 2019 20:22 — forked from strangerstudios/pmpro_cancel_on_next_payments_date.php
Change PMPro membership cancellation to set expiration date to be the end of the payment period, instead of cancelling immediately (except when payment gateway is causing cancellation)
<?php
/*
Change cancellation to set expiration date et expiration date to be the end of the current month, instead of cancelling immediately.
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
*/
function e20r_stripe_delete_action( $user_id ) {
@eighty20results
eighty20results / pmpro-validate-email-domain.php
Created March 3, 2016 16:58
Prevent sign-up from email addresses in $invalid_domains array (Line: 32)
<?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 / pmpro-load-custom-admin-page.php
Created March 3, 2016 14:38
Load additional "custom" fields to the advanced settings page.
<?php
/*
Plugin Name: PMPro Custom Admin Page
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Templated admin pages for Paid Memberships Pro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@eighty20results
eighty20results / hide-membership-levels.php
Created March 2, 2016 00:13
Hide all levels except the current user's membership level from the list of membership levels on display
<?php
/*
* Hide some levels from Levels page
*/
function my_pmpro_levels_array($levels) {
global $current_user;
// if the user is logged in
if (!empty($current_user->ID))
@eighty20results
eighty20results / functions.php
Created February 29, 2016 17:51
Proposal: pmpro_loadTemplate() function
function pmpro_loadTemplate($page_name = null, $type = 'pages', $ext = 'php' )
{
// called from page handler shortcode
if (is_null($page_name))
{
global $pmpro_page_name;
$page_name = $pmpro_page_name;
}
// template paths in order of priority (array gets reversed)
@eighty20results
eighty20results / pmpro-check-for-invalid-fqdn-in-email.php
Created February 29, 2016 12:57
Check for FQDNs that are supposed to trigger an "invalid email domain" error on checkout
<?php
function restrict_email($value)
{
$email = $_REQUEST['bemail'];
if(is_invalid($email))
{
global $pmpro_msg, $pmpro_msgt;
//TODO: Set the error text to be whatever you want it to be:
@eighty20results
eighty20results / pmpro-birthday-validation.php
Last active March 9, 2016 22:36
Collect birthdate on checkout
<?php
/*
Add birthday to user signup and check that user is between 13-17.
Will not work with PayPal Standard or PayPal Express.
*/
//birthday fields
function my_pmpro_checkout_after_user_fields()
{
$current_day = date("j");
@eighty20results
eighty20results / pmpro-rh-fields-for-femworking.php
Created February 16, 2016 17:34
Custom fields for Register Helper
<?php
/*
Plugin Name: Additional Checkout Fields (PMPro Register Helper)
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Additional Checkout page & profile fields for the Paid Memberships Pro Register Helper add-on
Version: .1
Author: Thomas Sjolshagen @ Stranger Studios <[email protected]>
Author URI: http://www.strangerstudios.com
*/
function my_add_pmpro_RH_fields()
@eighty20results
eighty20results / pmpro-rh-for-legacy-brands.php
Created February 16, 2016 15:54
Register Helper fields that also use the default WordPress meta field names for "First name" and "Last name".
<?php
/*
Plugin Name: Additional Checkout Fields (PMPro Register Helper)
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Additional Checkout page & profile fields for the Paid Memberships Pro Register Helper add-on
Version: .1
Author: Thomas Sjolshagen @ Stranger Studios <[email protected]>
Author URI: http://www.strangerstudios.com
*/
function my_add_pmpro_RH_fields()
@eighty20results
eighty20results / pmpro-rh-for-legacy-brands.php
Created February 16, 2016 15:47
Register Helper fields that also use the default WordPress meta field names for "First name" and "Last name".
<?php
function my_add_pmpro_RH_fields()
{
//require PMPro and PMPro Register Helper
if (!defined('PMPRO_VERSION') || !defined('PMPRORH_VERSION'))
return;
$fields = array();
$fields[] = new PMProRH_Field(
"first_name", // Input name, will also be used as the key to access as user meta