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
/* | |
Update Prices on the Pricing page for current members. | |
Add this code to a custom plugin. | |
*/ | |
function pmpro_level_cost_text_filter_pricing_page($cost, $level, $tags, $short) { | |
//if we're not on the pricing page, just return | |
global $pmpro_pages; | |
if(!is_page($pmpro_pages['levels'])) | |
return $cost; |
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 | |
/* | |
Redirect to a URL promoting an upsell unless the user already has that level. | |
Add this code into a custom plugin. | |
*/ | |
function pmpro_confirmation_url_to_upsell($rurl, $user_id, $pmpro_level) { | |
$upsell_level_id = 2; //change this | |
$upsell_url = 'https://example.com/upsell-page/'; //change this |
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
/* | |
If we 404, and the slug matches a discount code, redirect | |
Add this code to a custom plugin | |
*/ | |
function my_pmpro_pre_handle_404($preempt, $wp_query) { | |
global $wpdb; | |
//make sure we're 404ing | |
if(!is_404()) |
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
/** | |
* If a post has a code block, add a GPL note to the bottom of the post. | |
* This gist is meant to be run with the pull requests related to this | |
* issue on the Gutenberg GitHub repo: https://github.com/WordPress/gutenberg/issues/3773 | |
*/ | |
function test_mark_code_posts_for_gpl($content) { | |
if(gutenberg_content_has_block($content, 'core/code')) | |
$content .= '<p><strong>All code in this post is licensed under the GPL.</p>'; | |
return $content; |
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
#set order 1 to have user_id 1. change the order and user ids. | |
UPDATE wp_pmpro_membership_orders SET user_id = '1', status = 'success' WHERE id = 1 LIMIT 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
/* | |
Add this code to a custom plugin. | |
*/ | |
function bbpress_role_is_iu_post_user_import( $user_id ) { | |
//if you had a column in your import with the role in it, you can grab it from user meta instead of setting it here | |
$new_role_forum_role='bbp_participant'; | |
bbp_set_user_role( $user_id, $new_role_forum_role ); | |
} | |
add_action( 'is_iu_post_user_import', 'bbpress_role_is_iu_post_user_import'); |
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
/* | |
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 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
/* | |
Stop users from setting their username to an email address | |
Add this code to a custom plugin. | |
*/ | |
function pmpro_registration_checks_no_email_user_login($continue) { | |
//if there are earlier problems, don't bother checking | |
if(!$continue) | |
return; | |
//make sure the username passed in doesn't look like an email address (contains a @) |
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
/* | |
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 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> |
OlderNewer