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
// Delete Sponsored Members discount code uses whenever a sponsored member is cancelled/expired | |
function my_pmprosm_sponsored_discount_code_reuse($level_id, $user_id) { | |
global $pmpro_next_payment_timestamp; | |
// if we see this global is set, other code is planning on giving them their level back | |
if( !empty($pmpro_next_payment_timestamp) ) | |
return $level_id; | |
//make sure they're cancelling and they have a sponsored level | |
if( $level_id == 0 && pmprosm_isSponsoredLevel(pmpro_getMembershipLevelForUser($user_id)->ID) ) | |
{ | |
//get sponsor for user |
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 member has a pending check order for a level, don't show that level on the Levels page | |
* Compatible with the Advanced Shortcode Add On. | |
* Requires PMPro and Pay By Check to be installed and configured | |
*/ | |
function my_pmprobc_dont_show_pending_level( $level_array ){ | |
// get the last order for the current user | |
$last_order = new MemberOrder(); | |
$last_order->getLastMemberOrder(NULL, NULL); |
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
// change the text for the confirmation link in the PMPro Email Confirmation Add On welcome email | |
function my_pmproec_change_confirmation_text($body) | |
{ | |
//change this line to modify the confirmation text | |
$new_confirmation_text = "Click this link to activate your membership:"; | |
$old_confirmation_text = "IMPORTANT! You must follow this link to confirm your email address before your membership is fully activated:"; | |
$body = str_replace( $old_confirmation_text, $new_confirmation_text, $body ); | |
return $body; |
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
/** Don't show renewal link on the Levels page for Pay by Check users with pending orders | |
* Not compatible with the Advanced Levels Page Shortcode Add On; use this gist instead: https://gist.github.com/LMNTL/c8549aa27d259a21a2841560f4a2e1c5 | |
* requires Pay by Check Add On to be installed and configured | |
*/ | |
function my_pmprobc_no_renewal_before_approval( $show, $level ){ | |
// get the last order for the current user | |
$last_order = new MemberOrder(); | |
$last_order->getLastMemberOrder(NULL, NULL); |
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
/* | |
Require PMPro membership for all Download Monitor downloads. | |
Requires Paid Memberships Pro and Download Monitor to be installed and configured | |
NOTE: this will work with or without the Download Monitor Integration Add On for PMPro. | |
*/ | |
function my_pmpro_dlm_has_download_access( $continue ) { | |
/* you can change this line to restrict download to only specific levels | |
https://www.paidmembershipspro.com/documentation/content-controls/require-membership-function/ */ |
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
// don't include specific Register Helper checkout box/boxes on the checkout page for members | |
function my_pmprorh_remove_box_for_members(){ | |
if( pmpro_hasMembershipLevel() ) | |
{ | |
global $pmprorh_checkout_boxes; | |
// change this line to include the name of the checkout box(es) to remove | |
$boxes_to_remove = array("more_fields"); | |
$new_boxes = []; |
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
function my_pmpro_levels_array_cancelled($levels) | |
{ | |
$current_user = wp_get_current_user(); | |
$user_meta = get_userdata($current_user->ID); | |
if( in_array( "cancelled", $user_meta->roles ) ) | |
{ | |
$order = new MemberOrder(); | |
$order->getLastMemberOrder($current_user->ID, array("cancelled","expired","error")); | |
if( empty( $order->id ) ) | |
return $levels; |
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 | |
/* | |
Restrict members from accessing members-only content using a checkbox in the profile. | |
The button will only show when logged in as an admin. | |
Requires PMPro and Register Helper Add On to be installed, activated, and configured. | |
*/ | |
function my_pmprorh_init_restrict() | |
{ | |
//don't break if Register Helper is not loaded |
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 | |
/* | |
Changes Report for Paid Memberships Pro | |
Title: pmpro_reports_changes | |
Slug: pmpro_reports_changes | |
*/ | |
//update this array for your desired reports. the format is: "report name" => array( initial_level_id, current_level_id ), | |
global $pmpro_reports_level_changes; | |
$pmpro_reports_level_changes = array( | |
"Members upgrading from Level 1 to 2" => array( 1, 2), |