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 | |
/* | |
* Give users a new level after x successful payments at another level. | |
*/ | |
function my_pmpro_after_change_membership_level($level_id, $user_id, $cancel_level) | |
{ | |
global $wpdb; | |
// change number of payments here | |
$payments = 10; |
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 | |
/* Change /wp-admin/ Redirect After Login for Paid Memberships Pro */ | |
function my_pmpromh_login_redirect( $redirect_to, $request, $user ) | |
{ | |
$admin_url = get_admin_url(); | |
$landing_page_id = 11; //change this to the ID of the page you want to redirect the user to | |
if ( ! current_user_can( 'administrator' ) && $redirect_to == $admin_url ) { | |
$redirect_to = get_permalink( $landing_page_id ); | |
} |
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 | |
/* | |
Plugin Name: PMPro Stripe Billing Limits | |
Plugin URI: http://www.paidmembershipspro.com/add-ons/pmpro-stripe-billing-limits/ | |
Description: Allow billing limits with Stripe, where the Stripe subscription is cancelled, but the PMPro membership is not after X payments. | |
Version: .3 | |
Author: strangerstudios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
/* |
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 email subjects. | |
The function checks $email->template and updates the subject as needed. | |
The email template name will be equivalent to the filenames in the /email/ folder of the PMPro plugin. | |
*/ | |
function my_pmpro_email_subject($subject, $email) | |
{ | |
//only checkout emails |
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 | |
/** | |
* Change subject line of Checkout email based on membership level. | |
* | |
* @param string $subject The email's subject is a string of text that you can adjust here as you see fit or pull from another custom function. | |
* @param object $email This is the php object from which we extracting the appropriate level and to which we'll add the new email content. | |
* @return string Whichever condition applies in the function below will determine what string is supplied to the email object. If none of the conditions are met, the return string will be the original message subject. | |
*/ | |
function pmpro_adjust_email_subject_to_level_checkout( $subject, $email ) { |
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
/* | |
Allows renewing yearly memberships with a set expiration date. | |
E.g. if the level expires on 1/1/2020 and the member renews their membership before then, their membership will be extended to 1/1/2021 | |
Requires the Set Expiration Dates Add On for Paid Memberships Pro | |
*/ | |
function my_pmpro_yearly_membership_renewal($level) { | |
$extend_level = 1; //change to the level with a set expiration date | |
if( $level->id == $extend_level && pmpro_hasMembershipLevel( $extend_level ) ) |
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_after_change_membership_level_default_level($level_id, $user_id) | |
{ | |
//set this to the id of the level you want to give members when they cancel | |
$cancel_level_id = 1; | |
//if we see this global set, then another gist is planning to give the user their level back | |
global $pmpro_next_payment_timestamp; | |
if(!empty($pmpro_next_payment_timestamp)) | |
return; |
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 custom validation for Register Helper fields when editing from profile page. | |
Requires Paid Memberships Pro and Register Helper Add On. | |
*/ | |
function my_pmprorh_user_profile_validate_rhfields($errors, $update, $user) { | |
if( isset( $_POST['my_errors'] ) ){ | |
$my_errors = $_POST['my_errors']; | |
foreach( $my_errors as $single_error){ | |
$errors->add('my_pmprorh_error',__($single_error)); |
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 expiration text on levels page. | |
*/ | |
function pmprosed_my_pmpro_level_expiration_text($expiration_text, $level) | |
{ | |
$set_expiration_date = pmpro_getSetExpirationDate($level->id); | |
if (!empty($set_expiration_date)) { | |
$set_expiration_date = pmprosed_fixDate($set_expiration_date); | |
$expiration_text = "This membership level will expire on " . date(get_option('date_format'), strtotime($set_expiration_date, current_time('timestamp'))) . "."; | |
} |
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
// Always show the top discount code field on the checkout page for Paid Memberships Pro | |
function my_pmpro_always_show_discount_code() | |
{ | |
?> | |
<script> | |
jQuery(document).ready(function() { | |
jQuery('#other_discount_code_tr').show(); | |
jQuery('#other_discount_code_p').hide(); | |
jQuery('#other_discount_code').focus(); | |
}); |
OlderNewer