This file contains hidden or 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
/** | |
* Override the default is_downgrade check in the PMPro Proration Add On | |
* Add this code to a custom plugin. | |
* A rank of level orders is used to calculate downgrades from upgrades. | |
* Be sure to change the $level_order array below as needed. | |
* You can also do your own calculation on the $old_level and $new_level objects. | |
*/ | |
function pmpro_is_downgrade_custom_filter( $is_downgrade, $old_level, $new_level ) { | |
// this array contains all of the level ids in order of downgrade -> upgrade | |
// change this as needed |
This file contains hidden or 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 everything | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^maintenance.html maintenance.html [L] #setup nothing.html with your noth$ | |
RewriteCond %{REQUEST_URI} !^/?(wp-admin)/ | |
RewriteRule ^$ maintenance.html [L] | |
RewriteCond %{REQUEST_URI} !^/?(wp-admin)/ | |
RewriteRule . / [R,L] | |
#end redirect everything |
This file contains hidden or 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 MEPR IPN URL to the PMPro IPN URL, e.g. | |
https://yoursite.com/mepr/notify/onibvz-5w6/ipn => | |
https://yoursite.com/wp-admin/admin-ajax.php?action=ipnhandler | |
Update line 9 to match the IPN URL given to you by MEPR | |
*/ | |
function my_ipn_redirect() { | |
if( defined('PMPRO_DIR') && $_SERVER['REQUEST_URI'] === '/mepr/notify/onibvz-5w6/ipn' ) { | |
require_once(PMPRO_DIR . "/services/ipnhandler.php"); |
This file contains hidden or 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 | |
/** | |
* Make all fields editable on the Orders page in the PMPro dashboard. | |
* | |
*/ | |
function my_pmpro_orders_read_only_fields( $fields ) { | |
return array(); | |
} | |
add_filter( 'pmpro_orders_read_only_fields', 'my_pmpro_orders_read_only_fields' ); |
This file contains hidden or 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
/** | |
* Increase the timeout limit to 20 when making a call to the PMPro License Server | |
* Add this code to a custom plugin. | |
*/ | |
function my_pmpro_license_check( $timeout ) { | |
return 20; | |
} | |
add_filter( 'pmpro_license_check', 'my_pmpro_license_check' ); |
This file contains hidden or 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 | |
/** | |
* Custom Template for Print Invoices | |
* | |
* Copy this file into the paid-memberships-pro/pages/ folder of your active theme's directory. | |
* If that folder does not exist, create it. | |
* Keep the name orders-print.php | |
*/ | |
?> | |
<!doctype html> |
This file contains hidden or 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
/** | |
* Add some Register Helper field data to the order notes at checkout. | |
* | |
* 1. Update the $fields_to_add array below with the fields to save into the order notes. | |
* 2. Make sure PMPro Register Helper is active, the fields you want are setup and being added to the checkout page form. | |
* 3. Add this code to a custom plugin. | |
* | |
* Note that some advanced field types may not store their data in a human readable format. | |
* You may want to update this function to handle those field types specifically or to use | |
* nicer labels in the notes/etc. |
This file contains hidden or 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 new pmproap_text_level_id filter to choose the user's currenet level OR the most expensive level with access. | |
* The level with the highest initial payment is chosen. | |
* Update this code as needed and add to a custom plugin. | |
*/ | |
function choose_most_expensive_level_for_addon_packages( $text_level_id, $post_id, $user_id, $post_levels ) { | |
if ( ! pmpro_hasMembershipLevel( $text_level_id, $user_id ) ) { | |
$highest_initial_payment = 0; | |
foreach ( $post_levels as $level_id ) { | |
$level = pmpro_getLevel( $level_id ); |
This file contains hidden or 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 hidden or 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 | |
/* | |
Save this file to /themes/{active theme}/paid-memberships-pro/member-directory/tempaltes/directory.php | |
*/ | |
/* | |
This shortcode will display the members list and additional content based on the defined attributes. | |
*/ | |
function pmpromd_shortcode($atts, $content=null, $code="") | |
{ | |
// $atts ::= array of attributes |