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 | |
| /** | |
| * Adjust the PMPro PayPal gateway webhook ID to point to a new webhook that was manually created. | |
| * Run this in your browser once yoursite.com/wp-admin/?pp_webhook_id=12345 | |
| * Delete this snippet when no longer needed. | |
| * | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| add_action( 'admin_init', function() { | |
| if ( ! isset( $_GET['pp_webhook_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 | |
| /** | |
| * Manually overrides the YYYY-MM-DD settings of a set expiration date level. | |
| * If the checkout is 15-30 July of the current year, push it out by another year. | |
| * The example expiration date is 31 July of current year in the Set Expiration Date Add On. | |
| * | |
| * Tweak all the code accordingly for your needs, and add level ID checks for multiple level compatibility. | |
| * To add this code to your site you may follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_override_sed_date( $date ) { |
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 | |
| /** | |
| * Allows you to hotswap gateway logic at checkout via query parameter. | |
| * Helpful if the gateway doesn't have native gateway swapping capabilities. | |
| * Add &gateway=paypal (for example) to your checkout URL to load the new PayPal payment gateway. | |
| * | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| add_filter( 'pmpro_valid_gateways', function( $gateways ) { | |
| $gateways[] = 'paypal'; //Change paypal to any other gateway you have installed/configured. |
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 | |
| /** | |
| * WP-CLI command to generate test login records for When Last Login. | |
| * | |
| * INSTALLATION: | |
| * Add this line to your child theme's functions.php or any plugin file: | |
| * require_once __DIR__ . '/wll-generate-records.php'; | |
| * | |
| * USAGE: | |
| * wp wll-generate-records 1000 |
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 the donation only level if it's the first level purchased (including if it's your only level on your site). | |
| * Remove the "Donation Only Level" setting from the level if you want members to keep this level. | |
| * | |
| * To implement this code onto your site follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmprodon_pmpro_checkout_before_change_membership_level( $user_id, $morder ) { | |
| global $pmprodon_existing_member_flag, $pmpro_level; |
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 resolves an issue where the Set Expiration Date would change based on date of manual order confirmation. | |
| * To add this code to your site, follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmprosed_force_set_expiration_enddate( $enddate, $user_id, $level, $startdate ) { | |
| // Bail if no enddate or a NULL enddate. | |
| if ( $enddate === "NULL" || empty( $enddate ) ) { | |
| return $enddate; |
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 | |
| /** | |
| * Enable comments for Courses and Lessons for members with access. | |
| * People who don't have access will only be able to view comments only. Great for upselling lessons and courses. | |
| * | |
| * To add this code to your site, follow this guide - https://www.paidmembershipspro.com/documentation/templates/customizing-via-a-custom-plugin/ | |
| */ | |
| function my_pmpro_courses_enable_comments( $open, $post_id ) { | |
| // Check if the person has access to the post type to comment. |
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 | |
| /** | |
| * Removes the last "." from the level's cost text. | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_remove_period_from_cost_text( $cost_text, $level, $tags, $short ) { | |
| return rtrim( $cost_text, '. ' ); | |
| } | |
| add_filter( 'pmpro_level_cost_text', 'my_pmpro_remove_period_from_cost_text', 10, 4 ); |
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 | |
| /** | |
| * Allow <iframe> code in wp_kses_post calls. | |
| * Useful for embedding videos in Memberlite theme banner descriptions. | |
| * | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_allow_iframe_wp_kses_post( $tags, $context ) { | |
| if ( 'post' === $context ) { |
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 | |
| /** | |
| * Change the wording of the Prorations Downgrade Text. | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/documentation/templates/customizing-via-a-custom-plugin/ | |
| */ | |
| function my_pmpro_change_text( $translated_text, $text, $domain ) { | |
| if ( $domain == 'pmpro-proration' ) { | |
| if ( $text == 'Downgrading to %s on %s.' ) { | |
| $translated_text = 'Changing to %s on %s.'; // Adjust the wording here. | |
| } |
NewerOlder