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-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 <thomas@eighty20results.com>
Author URI: http://www.strangerstudios.com
*/
function my_add_pmpro_RH_fields()
@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 <thomas@eighty20results.com>
Author URI: http://www.strangerstudios.com
*/
function my_add_pmpro_RH_fields()
@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 / 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 / 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 / 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 / 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-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-single-trial-period-per-user.php
Last active March 14, 2016 20:05
During checkout, werify whether user has used the specified "trial" membership level before. If so, prevent them from checking out. User must remember to define the level ID for the trial membership in the PMPRO_CUSTOM_TRIAL_LEVEL constant.
<?php
/*
Plugin Name: PMPro Trial Membership Limits
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Prevent users from signing up for the Trial Membership Level more than once
Version: .1
Author: Thomas Sjolshagen w/Stranger Studios <thomas@eighty20results.com>
Author URI: http://www.strangerstudios.com
*/
/*
@eighty20results
eighty20results / dpesrh-field-defs.php
Created May 8, 2016 15:09
Register Helper Fields for DPES
<?php
/*
Plugin Name: PMPro Register Helper - Extra fields
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Extra registration fields
Version: .1
Author: Thomas Sjolshagen - PMPro Support <thomas@eighty20results.com>
Author URI: http://www.strangerstudios.com/
*/
function dpesrh_RH_fields()