This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Tell PMPro to look in the pages directory of this plugin for PMPro email templates. | |
Add this code to a custom plugin. | |
Make sure that there is a /email/ directory in the plugin directory with your templates in it. | |
*/ | |
function my_pmpro_email_custom_template_path($default_templates, $page_name) { | |
$default_templates[] = dirname(__FILE__) . '/email/' . $page_name . '.html'; | |
return $default_templates; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Redirect to the membership account page instead of the home page after email validation with the PMPro Email Confirmation add on. | |
* Add this code to a custom WordPress plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmproec_after_validate_user() { | |
if( is_user_logged_in() ) { | |
wp_safe_redirect( '/membership-account/' ); | |
} else { | |
wp_safe_redirect( wp_login_url( '/membership-account/' ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Use PMPro Register Helper to add PMPro Billing Address fields to the edit user page for admins. | |
*/ | |
function show_pmpro_address_fields_on_edit_profile() | |
{ | |
//require PMPro and PMPro Register Helper | |
if(!defined('PMPRO_VERSION') || !defined('PMPRORH_VERSION')) | |
return; | |
$address_fields = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This code handles loading a file from the /protected-directory/ directory. | |
(!) Be sure to change line 19 below to point to your protected directory if something other than /protected/ | |
(!) Be sure to change line 66 below to the level ID or array of level IDs to check for the levels you need. | |
(!) Add this code to your active theme's functions.php or a custom plugin. | |
(!) You should have a corresponding bit of code in your Apache .htaccess file to redirect files to this script. e.g. | |
### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow other business email addresses for PMPro IPN Messages. | |
* To add this code to your site you may follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_ipn_check_receiver_email($check, $email) { | |
if ( in_array( 'bbb@gmail.com', $email ) ) { //change email here to the old email | |
$check = true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This filter will search your codebase for translatable strings and replace when an exact match is found. | |
* | |
* Here we're changing 'Membership' to 'Subscription' for Paid Memberships Pro. | |
* | |
* Add this code to your PMPro Customizations Plugin | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Filter membership level names and descriptions for translating. | |
* | |
* Add this code to a custom plugin or your active theme's functions.php file. | |
* Be sure to update the $pmpro_translated_levels array. Add a sub array for each locale. | |
* The sub array keys should be the membership level ids, | |
* and values should be an array with the name and description to translate to. | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prorate the initial payment at PMPro checkout based on the day of the month. | |
* You should use the Subscription Delays add on to set your subscription | |
* to delay until Y1-M1-01. | |
*/ | |
function my_pmpro_checkout_level( $level ) { | |
$current_day = date( 'j' ); | |
// Ignore if it's the first of the month. | |
if ( $current_day == 1 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* If a user checked option1, then add $100 to the price. | |
*/ | |
function my_pmpro_checkout_level($level) { | |
if( ! empty( $_REQUEST['option1'] ) || ! empty( $_SESSION['option1'] ) ) { | |
$level->initial_payment = $level->initial_payment + 100; | |
//$level->billing_amount = $level->billing_amount + 100; //to update recurring payments too | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Link discount codes to affiliates. | |
*/ | |
//this is the parameter we're looking for to find affiliates... based on which plugin/etc you are using | |
define('PMPRO_LDC2AFF_KEY', 'wpam_id'); //Affiliates Manager Plugin | |
//define('PMPRO_LDC2AFF_KEY', 'pa'); //WordPress Lightweight Affiliates | |
//define('PMPRO_LDC2AFF_KEY', 'ref'); //AffiliateWP | |
//helper function to get the values from options and make sure they are an array |