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 | |
| /** | |
| * This will only allow users to checkout with specific zip codes for the Shipping Add On for Paid Memberships Pro. | |
| * You will need to use this code recipe together with the PMPro Shipping Address Add On - https://www.paidmembershipspro.com/add-ons/shipping-address-membership-checkout/ | |
| * Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_valid_zip_codes( $pmpro_continue_registration ) { |
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 | |
| /** | |
| * This will exclude products that belong to a specific category from the membership discount. | |
| * Add the below code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_exclude_woocommerce_discounts_for_categories( $price, $level_id, $original_price, $product ) { | |
| // Array of categories to exclude, uses category slug. | |
| $exclude_categories = array( 'category-1', 'category-2', 'category-3' ); |
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 | |
| /** | |
| * 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 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 | |
| /** | |
| * 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 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 // 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 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 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 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
| <?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 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 on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On) | |
| * Adjust the code on the line the line "site_url( ' payment-failed')" to redirect to page of your prefereance. | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_login_redirect_url( $url, $request, $user ) { | |
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 custom CSS on checkoutpage for specific membership level in Paid Memberships Pro. | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function load_css_for_level_checkout(){ | |
| global $pmpro_pages; | |
| // Change your membership level ID here. |
NewerOlder