Skip to content

Instantly share code, notes, and snippets.

<?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
*/
@messica
messica / pmpro-customizations.php
Created March 18, 2015 15:25
Show Billing Address Fields in Profile
<?php
/*
* Add PMPro Billing Fields to Profile
*/
function my_show_extra_profile_fields($user)
{
global $pmpro_states;
?>
@messica
messica / pmproseries_shortcode.php
Created March 27, 2015 16:55
Adds a [pmproseries] shortcode to display a specific series post list.
function pmproseries_shortcode($atts) {
global $post;
extract(shortcode_atts(array(
'id' => $post->ID
), $atts));
//start output buffering
ob_start();
$series = new PMProSeries($id);
$series->getPostList(true); //true echoes post list
/*
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-customizations.php
Created June 2, 2015 16:44
Force Add PayPal Express + Pay by Check addons to work together
<?php
/*
* Force Add PayPal Express + Pay by Check addons to work together
*/
function my_init() {
remove_action("pmpro_checkout_boxes", "pmpropbc_checkout_boxes");
remove_action("pmpro_checkout_boxes", "pmproappe_pmpro_checkout_boxes", 20);
}
add_action('init', 'my_init');
@messica
messica / my_pmprorh_init.php
Last active April 24, 2020 13:33
Additional TOS Page example for Register Helper
<?php
/*
* Additional Terms of Service Page example for Register Helper
* applies formatting & shortcodes, uses post title for field label
*/
function my_pmprorh_init()
{
// Set additional Terms of Service post ID here.
$tos_page = 4;
@messica
messica / my_pmpro_currencies.php
Created August 6, 2015 15:27
Move the default position of the currency symbol for EUR from right to left.
<?php
// Move the default position of the currency symbol for EUR from right to left.
// 50.00€ -> €50.00
function my_pmpro_currencies($currencies) {
$currencies['EUR']['position'] = 'left';
return $currencies;
}
add_filter('pmpro_currencies', 'my_pmpro_currencies');
@messica
messica / my_pmpro_confirmation_url.php
Created August 27, 2015 20:18
Redirect to last post viewed instead of confirmation page
<?php
/*
* Remember last post ID
*/
function my_wp() {
global $post, $pmpro_pages;
//don't track pmpro pages
if( ! in_array($post->ID, $pmpro_pages))
setcookie('last_post_viewed', $post->ID, null, '/');
@messica
messica / referral_stripe_updates.php
Created August 28, 2015 16:11
Example code to set subscription updates automatically for referrals (Stripe only)
<?php
/*
* Example code to set subscription updates automatically for referrals (Stripe only)
*/
function my_init() {
//check for referral ID and set a cookie
if(!empty($_REQUEST['referral_id']))
setcookie('referral_id', $_REQUEST['referral_id'], null, '/');
}
@messica
messica / my_init.php
Created October 20, 2015 15:58
Generate invite codes for all users with a certain membership level.
<?php
/*
* Generate invite codes for all users with a certain membership level.
*/
function my_init() {
if ( ! empty( $_REQUEST['create_invites'] ) && current_user_can( 'manage_options' ) ) {
global $wpdb;