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 | |
| /** | |
| * Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order. | |
| * Add this code recipe to a PMPro Customization Plugin - Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order | |
| * Various classes added to strings to allow for styling - ".pmpro-discorig-message", ".pmpro-orginal-price", ".pmpro-discount-price", ".pmpro-save-price" | |
| * | |
| * [my_pmpro_applydiscountcode_return_js] Display original price and discount when a discount code is applied. | |
| * @param string $discount_code [description] | |
| * @param integer $discount_code_id [description] |
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 | |
| /** | |
| * 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 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. |
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 | |
| /** | |
| * Send the Paid Memberships Pro invoice email on initial checkout for members. | |
| * Add this code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function pmpro_after_checkout_send_invoice_email( $user_id, $order ) { | |
| $email = new PMProEmail(); | |
| $email->sendInvoiceEmail( $user_id, $order ); | |
| } |
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 // Do not copy this PHP tag. | |
| /** | |
| * Send recurring subscription payment email reminder 14 days before subscription payment. | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_change_recurring_emails( $emails ) { | |
| // Remove the email that is sent 7 days before subscription payment. | |
| unset( $emails[7] ); | |
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 //Do not copy this tag. | |
| // Copy the function below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| // Use the shortcode [membership_level] to display the user's current membership level. | |
| function pmpro_membership_level_shortcode( $atts ){ | |
| if(is_user_logged_in() && function_exists( 'pmpro_hasMembershipLevel' ) && pmpro_hasMembershipLevel()){ | |
| global $current_user; | |
| $current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID); | |
| return sprintf(__( "Your current level is: %s", "pmpro" ), $current_user->membership_level->name); |
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 | |
| function my_init_email_as_username() | |
| { | |
| //check for level as well to make sure we're on checkout page | |
| if(empty($_REQUEST['level'])) | |
| return; | |
| if(!empty($_REQUEST['bemail'])) | |
| $_REQUEST['username'] = $_REQUEST['bemail']; | |
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 // Do not copy this tag. | |
| /** | |
| * Replace all spaces with an underscore when new users register for Paid Memberships Pro. | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_custom_user_registration_changes( $userdata ) { | |
| $userdata['user_login'] = str_replace(' ', '_', $userdata['user_login'] ); |
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 // Careful not to copy this php tag. | |
| /** | |
| * Add 'pages' for Limit Post Views Add On for Paid Memberships Pro. You may also add your custom post types using this function below. | |
| * Requires the Paid Memberships Pro - Limit Post Types Add On to work: https://www.paidmembershipspro.com/add-ons/pmpro-limit-post-views/ | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function pmpro_lpv_add_my_post_types( $post_types ) { | |
| // Add pages to post type array to restrict Limit Post Views. | |
| $post_types[] = 'page'; |