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 | |
| /** | |
| * Remove "Cancel" button for cancelled subscriptions. | |
| * | |
| * The user is still able to cancel auto-renew, but can't completely cancel the membership. | |
| */ | |
| add_filter( 'pmpro_member_action_links', function ( $pmpro_member_action_links ) { | |
| global $current_user; | |
| // bail if cancel link has been removed by someone else |
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 | |
| /** | |
| * Show the expiration time for a member's level on the Membership Account page. | |
| * Useful for sites that offer hourly membership. | |
| * Requires PMPro v2.6+ | |
| * | |
| * You can add this recipe to your site by creating a custom plugin | |
| * or using the Code Snippets plugin available for free in the WordPress repository. | |
| * | |
| */ |
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 13% tax to all Canadian customers checking out for a membership level. | |
| * To add this code to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function customtax_pmpro_tax_ca($tax, $values, $order) { | |
| if ( $_SESSION['bcountry'] == 'CA' || $_REQUEST['bcountry'] == 'CA' ) { | |
| $tax = round( (float) $values[price] * 0.13, 2 ); | |
| } | |
| return $tax; |
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 | |
| /** | |
| * If a user checked option1, then add $100 to the price. | |
| */ | |
| function my_pmpro_checkout_level($level) { | |
| if( ! empty( $_REQUEST['option1'] ) || ! empty( $_SESSION['option1'] ) ) { | |
| $level->initial_payment = $level->initial_payment + 100; | |
| //$level->billing_amount = $level->billing_amount + 100; //to update recurring payments too | |
| } |
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 | |
| // Copy from below here... | |
| /* | |
| * Creates a log at /paid-memberships-pro/logs/level-change.txt for whenever a | |
| * membership is expired. | |
| */ | |
| function my_pmpro_pre_membership_expiry_log( $user_id, $membership_id ) { | |
| global $wpdb; |
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 recipe will create a shortcode that returns an image based on the level selected. | |
| * | |
| * You can add this recipe to your site by creating a custom plugin | |
| * or using the Code Snippets plugin available for free in the WordPress repository. | |
| * Read this companion article for step-by-step directions on either method. | |
| * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| * | |
| */ |
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 | |
| /** | |
| * Once a user checks out for a level, it will add usermeta to the user's account. | |
| * This will then remove any subscription delay for that member in the future, even if the user cancels and then re-signs up. | |
| */ | |
| // Update level meta everytime a user changes their level to ensure they are blocked from subscription delays. | |
| function my_pmpro_trial_used( $level_id, $user_id ) { | |
| update_user_meta( $user_id, "pmpro_trial_level_used", "1" ); | |
| } |
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 | |
| /* | |
| * Creates a custom merge field in MailChimp. | |
| */ | |
| function my_pmpro_mailchimp_merge_fields( $merge_fields ) { | |
| $merge_fields[] = array( | |
| 'name' => 'GOAL', | |
| 'type' => 'text' | |
| ); |
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 | |
| /** | |
| * Geocodebilling fields when adding a member using the Add Member From Admin Add On | |
| * | |
| * You can add this recipe to your site by creating a custom plugin | |
| * or using the Code Snippets plugin available for free in the WordPress repository. | |
| * Read this companion article for step-by-step directions on either method. | |
| * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| * | |
| */ |
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 user's email address through to Zapier on updated_order action | |
| * | |
| * You can add this recipe to your site by creating a custom plugin | |
| * or using the Code Snippets plugin available for free in the WordPress repository. | |
| * Read this companion article for step-by-step directions on either method. | |
| * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| * | |
| */ |
NewerOlder