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
/* | |
Tell the PMPro Proration Add On that every level change is a "downgrade" or sidegrade. | |
This will cause the PMPro checkout to always charge $0 for level changes, while setting up | |
a subscription to charge the new plan price on the next payment date. | |
This is useful if you have all recurring membership levels that are basically payment plans vs | |
differently priced levels. | |
Add this code to a custom plugin. |
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 | |
/** | |
* Define the default level to use for the modal | |
*/ | |
$uri = $_SERVER['REQUEST_URI']; | |
$page_slug = '/about'; | |
if( strpos($uri, $page_slug) !== false ) { | |
define('PMPRO_MODAL_CHECKOUT_DEFAULT_LEVEL', 2); | |
} else { | |
define('PMPRO_MODAL_CHECKOUT_DEFAULT_LEVEL', 1); |
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
/* | |
Define the global array below for your main accounts and sponsored levels. | |
Array keys should be the main account level. | |
*/ | |
global $pmprosm_sponsored_account_levels; | |
$pmprosm_sponsored_account_levels = array( | |
//set 5 seats at checkout | |
1 => array( | |
'main_level_id' => 1, //redundant but useful | |
'sponsored_level_id' => array(2,3), //array or single 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
/* | |
Replace strings in the PMPro Sponsored Members Add On | |
Add this code to a custom plugin. | |
Note we check for 2 different but similar text domains. We SHOULD | |
set our text domains to match the slug of the plugin, but in this | |
case we used underscores instead of dashes and need to support both | |
for backwards compatability. | |
The original text must match exactly how it shows up in the code. |
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 | |
$now = date('Y-m-d H:i:s', time()) | |
?> | |
<html><head><title>Cache Test (<?php echo $now;?>)</title></head> | |
<body> | |
<h1>Cache Test</h1> | |
<p><?php echo 'Time right now: <strong>' . $now . '</strong>'; ?> | |
</p> | |
<p>If this doesn't refresh on page load, then something is caching this page.</p> | |
<p>You can try adding ?t=arandomnumberorstring to the end of the URL to break the cache. You'll see the current time.</p> |
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
/* | |
Only redirect away from single topic and single reply pages. | |
Add this code to a custom plugin. | |
*/ | |
function wp_maybe_disable_pmprobbp_check_forum() { | |
global $post; | |
if(function_exists('bbp_is_topic') && !bbp_is_topic($post->ID) && !bbp_is_reply($post->ID)) { | |
remove_action( 'template_redirect', 'pmprobbp_check_forum' ); | |
remove_filter( 'pmpro_search_filter_post_types', 'pmprobb_pmpro_search_filter_post_types' ); |
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
# | |
# PMPro will sometimes get bad data in the wp_pmpro_memberships_users table. | |
# This happens often during imports and/or when levels are deleted. | |
# These queries below will search for bad records and inactivate them. | |
# Run queries (c) and (e) to deactivate the bad records. | |
# The other queries are for reference. | |
# IMPORTANT NOTE: If your DB prefix is not wp_, you will have to update it in the queries below | |
# | |
# (a) show latest entries in mu | |
SELECT * FROM wp_pmpro_memberships_users ORDER BY id DESC; |
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 | |
/* | |
Sometimes you have FTP access to a site, but don't have a WP administrator account. | |
You can use this code to create one. | |
1. Add this code into any plugin or theme file that you know will be run. | |
2. Visit /?createmyadministratoruser=1. | |
3. Delete the code you added. | |
*/ | |
function init_create_my_administrator_user() { |
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
/** | |
* Make sure first period discounts can only be used once. | |
* | |
* If a user already checked out for another level in this group, | |
* set the initial payment to match the billing amount. | |
* | |
* Edit the array of level_ids below and then add this code into a custom plugin. | |
*/ | |
function pmpro_checkout_level_initial_payments_once($level) { | |
if( !is_user_logged_in() ) { |
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
/* | |
1. Make sure PMPro and PMPro Proration are both active. | |
2. Edit the pmpro_checkout_level_custom_prorating_rules function below to your needs. | |
3. Then add this code into a custom plugin for your site. | |
*/ | |
/** | |
* Swap in our custom prorating function. | |
*/ | |
function init_custom_prorating_rules() { |