Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
strangerstudios / PMPExpirationDate
Last active Jul 4, 2019 — forked from chrislema/PMPExpirationDate
Set a specific expiration date for a Membership Level.
View PMPExpirationDate
/*
For a level to expire on a certain date.
(Note, this will need to be tweaked to work with PayPal Standard.)
*/
function my_pmpro_checkout_level_specific_expiration($level)
{
//ignore renewals (they will be pushed out one payment period)
if(pmpro_hasMembershipLevel($level->id))
return $level;
@strangerstudios
strangerstudios / my_pmpro_email_body.php
Last active Mar 21, 2018 — forked from scottsousa/gist:6700307
This code recipe adds the level’s Confirmation Message (under Memberships > Levels > Edit Level) to the membership checkout e-mail.
View my_pmpro_email_body.php
/**
* This function allows a custom confirmation message to be added to a checkout e-mail template. This will allow you to add
* your custom confirmation message to an e-mail template, without creating your own custom template in your theme.
*
* We're checking for the "checkout_" prefix on the e-mail template name and if we have current user data.
* We're then getting the custom confirmation level based on the current user data.
* We replace the 'is now active.</p>' portion of the body to append the confirmation message.
*/
add_filter( 'pmpro_email_body', 'my_pmpro_email_body', 10, 2 );
function my_pmpro_email_body( $body, $email ) {
View my_pmprorh_init.php
<?php
/*
Plugin Name: Register Helper Example
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Register Helper Initialization Example
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
View my_pmprorh_init.php
<?php
/*
Plugin Name: Register Helper Example
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Register Helper Initialization Example
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
@strangerstudios
strangerstudios / pmpro-restrict-countries.php
Created May 10, 2016 — forked from greathmaster/pmpro-restrict-countries.php
Restrict certain countries from signing up for certain levels.
View pmpro-restrict-countries.php
function my_init()
{
global $restricted_countries;
//specify the countries not allowed to signup. The key is the level id.
$restricted_countries = array(
1 => array('FR', 'IT'),
2 => array('IT'),
);
}
@strangerstudios
strangerstudios / pmpro-apply-addon-access-to-all-child-pages.php
Last active Feb 28, 2019 — forked from eighty20results/pmpro-apply-addon-access-to-all-child-pages.php
Protect all child pages of a page protected by the "Protect Add-on Pages" add-on
View pmpro-apply-addon-access-to-all-child-pages.php
<?php
/*
Plugin Name: Paid Memberships Pro - Protect Child Pages Add On
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Apply protection to all child pages of a Add-on Page that's protected.
Version: .1
Author: Thomas Sjolshagen @ Stranger Studios <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
*/
/**
@strangerstudios
strangerstudios / howibuit.md
Created Aug 5, 2016 — forked from jcasabona/howibuit.md
Guest Notes for How I Built It Podcast
View howibuit.md

Guest Notes for How I Built It Podcast

Format

We will pick a product you developed to talk about and I will ask 6 questions about it. The target is a 20-30 minute show that's pretty focused.

I will open the show, mention the show's sponsor(s) and then introduce you. We'll then jump into the questions.

Questions

View pmpro-mailchimp-merge-with-address-field.php
<?php
//Address merge types must be handled in a very specific format
function my_pmpro_mailchimp_listsubscribe_fields($fields, $user)
{
$user_info = get_userdata($user->ID);
$new_fields = array(
"FNAME" => $user->first_name,
"EMAIL" => $user->email,
"LNAME" => $user->last_name,
@strangerstudios
strangerstudios / my_pmpro_dashboard_report.php
Last active Mar 21, 2018 — forked from andrewlimaza/my_custom_dashboards.php
Show Membership Reports on the WordPress Admin Dashboard
View my_pmpro_dashboard_report.php
<?php
/*
Show Members Reports on the WordPress Admin Dashboard.
Update the my_pmpro_dashboard_report() function to remove or add core or custom reports.
*/
//Create a Dashboard Reports widget for Paid Memberships Pro
function add_my_report_dashboard() {
if( ! defined( 'PMPRO_DIR' ) || ! current_user_can( 'manage_options' ) )
{
@strangerstudios
strangerstudios / pmpro_hide_level_from_levels_page.php Limits the visibility of a level on the Levels page. Unlike setting "Allow Signups" members can access the checkout page to renew if needed.
View pmpro_hide_level_from_levels_page.php
<?php
//Save the pmpro_show_level_ID field
function pmpro_hide_level_from_levels_page_save( $level_id ) {
if( $level_id <= 0 ) {
return;
}
$limit = $_REQUEST['pmpro_show_level'];
update_option( 'pmpro_show_level_'.$level_id, $limit );
}
add_action( 'pmpro_save_membership_level','pmpro_hide_level_from_levels_page_save' );
You can’t perform that action at this time.