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 | |
/** | |
* Edit Teaser Messages Depending on Content | |
* | |
*/ | |
function pmpro_pmpro_not_logged_in_text_filter( $text ) { | |
global $post; | |
$access = pmpro_has_membership_access( $post->ID, NULL, true ); | |
$level_ids = $access[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
<?php | |
/** | |
* Redirect non-members to the Membership Levels page if they do not have a membership level. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
*/ |
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 | |
/** | |
* Remove variable pricing requirements if a discount code is set. | |
* Follow this guide to add this code snippet to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Visit www.paidmembershipspro.com for more information. | |
*/ | |
function my_pmpro_remove_vp_check_discount_code( $continue ) { | |
global $pmpro_level; |
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
/** | |
* Forward PMPro IPNs to another PMPro site. | |
*/ | |
function my_pmpro_forward_ipn() { | |
$fp = wp_remote_post( 'https://theothersite.com/wp-admin/admin-ajax.php?action=ipnhandler', $_POST ); | |
} | |
add_action('wp_ajax_nopriv_ipnhandler', 'my_pmpro_forward_ipn', 5); | |
add_action('wp_ajax_ipnhandler', 'my_pmpro_forward_ipn', 5); |
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 | |
/** | |
* Trigger admin activity email. | |
* | |
* To send a test email, go to yoursite.com/?test_admin_activity_email=1 | |
*/ | |
function pmpro_test_activity_email() { | |
if ( ! empty( $_REQUEST['test_admin_activity_email'] ) ) { | |
$email = new PMPro_Admin_Activity_Email; |
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 | |
/** | |
* Require user's checking out for any level that requires billing to match their IP address with billing country address fields. | |
* Only works with levels that require billing fields. | |
* Please install and activate the following plugin - https://wordpress.org/plugins/geoip-detect/ | |
*/ | |
function pmpro_require_location_match_IP( $continue ) { | |
global $pmpro_requirebilling; |
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
/** | |
* This gist will disable the default behavior in PMPro BuddyPress 5.2.5 or earlier, | |
* which would redirect users away from the BP profile pages if you had | |
* "all of BuddyPress" locked down for non-members or members of a specific level. | |
* | |
* We might address this in future versions of the Add-On, but for now, you can use | |
* this gist. Add it to a Code Snippet or a custom plugin. | |
*/ | |
// First disable the default PMPro BuddyPress behavior. |
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 | |
/** | |
* We'll add in a check to see which membership level was purchased. | |
* We can then specify which webhook each level should send data to. | |
* If it doesn't meet the criteria of our check, we'll use the default | |
* in the settings page. | |
* That URL is then added to the $data array | |
*/ | |
function mypmpro_multiple_zapier_webhooks_after_order( $data, $order, $user_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 | |
/** | |
* Remove user data manually by adjusting the ID's in the array, or adding them into a | |
* query param by setting it to /?reset_test_accounts=true&accounts=2,3 | |
* This works well if you've deleted the user accounts already and want to remove the | |
* first few users you'd initially tested with | |
*/ | |
function pmpro_remove_test_accounts( $user_id = null ){ | |
if( isset( $_REQUEST['reset_test_accounts'] ) && $_REQUEST['reset_test_accounts'] == 'true' ){ |
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 | |
/** | |
* Load session earlier to remove warning. | |
* Add code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_load_pmpro_sessions_earlier() { | |
remove_action('pmpro_checkout_preheader_before_get_level_at_checkout', 'pmpro_start_session' ); | |
} | |
add_action( 'init', 'my_load_pmpro_sessions_earlier' ); | |
add_action('init', 'pmpro_start_session' ); |