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 | |
/** | |
* This code stores data when a user checks out for a level. | |
* If that user tries to checkout for the same level, the Subscription Delay is removed. | |
* The user is instead charged for their first subscription payment at checkout. | |
* | |
*/ | |
// Record when users gain the trial level. | |
function one_time_trial_save_trial_level_used( $level_id, $user_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 | |
/** | |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext | |
* A simple gist that changes "Pay by Check" to "Pay by Cheque or Bank Transfer:". | |
* Copy the code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_text_strings( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case 'Pay by Check' : |
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 | |
/** | |
* Use the pmprowoo_get_membership_price filter to set prices for variable products. | |
* Update the $membership_prices array. | |
* Each item in that array should have a key equal to the membership level id, | |
* and a value equal to an array of the form array( {variable_product_id} => {member_price} ) | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmprowoo_get_membership_price( $discount_price, $level_id, $original_price, $product ) { | |
// Setup your arrays of product ids to membership prices. |
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
/* | |
* | |
* The following CSS code will hide the PMPro username field, label and the required asterisk. | |
* Add this CSS to your WordPress Customizer's Additional CSS section (WP Dashboard > Appearance > Customizer > Additional CSS) | |
* Code Recipe intended to be used along with the following gist: https://gist.github.com/travislima/4d599cc0b6169ef7ee7514442f289123 | |
* | |
*/ | |
.pmpro_checkout-field-username { | |
display: none; |
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 // be mindful about not duplicating this tag in your customizations plugin. | |
/** | |
* This will show the renewal date link within the number of days or less than the members expiration that you set in the code gist below. | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function show_renewal_link_after_X_days( $r, $level ) { | |
if ( empty( $level->enddate ) ) { | |
return false; | |
} |
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 a member for first time login. | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* www.paidmembershipspro.com | |
*/ | |
function first_time_login_redirect( $redirect_to, $request, $user ) { | |
//check level | |
if ( ! empty( $user ) && ! empty( $user->ID ) && function_exists( 'pmpro_getMembershipLevelForUser' ) ) { |
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 | |
/** | |
* 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 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 | |
/* | |
* The Code Recipe will add a 15-day grace period to a members membership once the membership expires. | |
* Add this Code Recipe to a PMPro Customization Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* For more information on Paid Memberships Pro - www.paidmembershipspro.com | |
*/ | |
function my_pmpro_membership_post_membership_expiry( $user_id, $level_id ) { | |
// Make sure we aren't already in a grace period for this level | |
$grace_level = get_user_meta( $user_id, 'grace_level', true ); |
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 | |
/** | |
* Stop members from renewing their current membership level. | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function stop_members_from_renewing( $okay ) { | |
// If something else isn't okay, stop from running this code further. | |
if ( ! $okay ) { |
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 //Do not copy this tag. | |
/** | |
* Add custom fields to Paid Memberships Pro checkout page. | |
* Must have PMPro & Register Helper Add On installed and activated to work. | |
* Add this code to a PMPro Customizations Plugin or Code Snippets plugin. | |
*/ | |
function pmpro_add_fields_to_checkout(){ | |
//don't break if Register Helper is not loaded |
NewerOlder