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
<?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 | |
/** | |
* 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 | |
/* | |
* 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 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. |
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 | |
/** | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* The my_pmpro_renew_membership_shortcode is a custom function creating a renew link for members. | |
* Use the shortcode [pmpro_renew_button] to display the button anywhere on your site where shortcodes are recognized. | |
* | |
* @return string A link containing the URL string to renew. | |
*/ | |
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 | |
/** | |
* Automatically approve any previously approved member. | |
* Requires the PMPro Approval Process for Membership Add On - https://www.paidmembershipspro.com/add-ons/approval-process-membership/ | |
* Add this code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_automatically_approve_previously_approved( $level_id, $user_id, $cancelled_level ) { | |
if ( ! class_exists( 'PMPro_Approvals' ) ) { |
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 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' ); |
NewerOlder