Skip to content

Instantly share code, notes, and snippets.

<?php
/*
Template for adding a shortcode page to a plugin. Steps:
1. Include this file.
2. Add [my_page_shortcode] shortcode to a page of the site.
3. Navigate to the page on the front end.
Be sure to change the name of the shortcode and the function names below.
<?php
/*
Plugin Name: PMPro WP Affiliate Platform Integration
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-dev/
Description: Process an affiliate via WP Affiliate Platform after a PMPro checkout.
Version: .3
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
Both Paid Memberships Pro (http://wordpress.org/extend/plugins/paid-memberships-pro/) and WP Affiliate Platform (http://www.tipsandtricks-hq.com/wordpress-affiliate/) must be installed and activated.
<?php
/*
Plugin Name: PMPro Customizations (Register Helper Example)
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for Paid Memberships Pro (Register Helper 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
@messica
messica / my_pmprorh_init.php
Last active August 29, 2015 14:01 — forked from strangerstudios/pmpro-customizations.php
Register Helper Initialization Example
<?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
<?php
/*
Prorated payments. When a member chooses to upgrade,
he should be charged a pro-rated amount for the new membership level immediately,
and the payment date should stay the same.
Assumes initial payments are equal to billing amount.
Add this code to your active theme's functions.php or include this in a custom plugin.
*/
<?php
/*
Plugin Name: PMPro Address For Free Levels
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-address-for-free-levels/
Description: Show address fields for free levels also with Paid Memberships Pro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
<?php
/*
Plugin Name: PMPro Custom Import
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Custom Import Code for PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
Show payment options (as levels) at checkout.
*/
// Define groups of levels. array(1,2) means that levels 1 and 2 are in a group and options will be shown for both levels at checkout for those levels.
global $pmpro_level_groups;
$pmpro_level_groups = array(array(1,2));
//show options at checkout
function pmprogl_pmpro_checkout_boxes()
@messica
messica / pmpro_cancel_on_next_payments_date.php
Created March 30, 2017 20:58 — forked from strangerstudios/pmpro_cancel_on_next_payments_date.php
Change PMPro membership cancellation to set expiration date for next payment instead of cancelling immediately.
/*
Change cancellation to set expiration date for next payment instead of cancelling immediately.
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs.
*/
//before cancelling, save the next_payment_timestamp to a global for later use. (Requires PMPro 1.8.5.6 or higher.)
function my_pmpro_before_change_membership_level($level_id, $user_id) {
//are we on the cancel page?
@messica
messica / test_set_expiration_dates.php
Last active March 23, 2021 14:54 — forked from ideadude/test_set_expiration_dates.php
Testing the pmprosed_fixDate() function of PMPro Set Expiration Dates
/**
* Testing the pmprosed_fixDate function.
* 1. Make sure PMPro and PMPro Set Expiration Dates is active.
* 2. Add this code to a custom plugin.
* 3. Visit ?test_fix_date=1 to a URL
* 3a. Add &use_test_date to test from a custom date (set $now below)
* 4. Remember to remove the code when done.
*/
function test_set_expiration_dates() {
if ( empty( $_REQUEST['test_fix_date'] ) ) {