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 | |
/* | |
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 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
/* | |
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 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
/* | |
Default to the blackfriday discount code if none is set. | |
Add this code to a custom plugin. | |
*/ | |
function init_default_pmpro_discount_code() { | |
//edit and uncoment this line to limit this to a specific page; note that "is_page" won't work yet | |
//if(strpos($_SERVER['REQUEST_URI'], '/blackfriday') === false) return; | |
if(!isset($_REQUEST['discount_code'])) { | |
$_REQUEST['discount_code'] = 'blackfriday'; |
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
/* | |
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 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
/** | |
* 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 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 | |
*/ | |
define('PMPRO_MODAL_CHECKOUT_DEFAULT_LEVEL', 1); | |
/** | |
* Load the checkout preheader on every page | |
* We won't be processing on every page, but we | |
* want the code that sets up the level and |
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 all fields (including transaction ids) editable on the orders page in the PMPro dashboard. | |
Add this code to a custom plugin. | |
*/ | |
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
#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 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 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 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
/* | |
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 @) |
OlderNewer