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 View and Print Membership Card Link from the Membership Account page. | |
| * To add this code to your site, please visit - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_hide_membership_card_link() { | |
| remove_action( 'pmpro_member_links_top', 'pmpro_membership_card_member_links_top' ); | |
| } | |
| add_action( 'init', 'my_pmpro_hide_membership_card_link' ); |
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 | |
| /** | |
| * For existing group parents, show current seat count and pre-fill the seats field. | |
| * Runs before the group-accounts plugin's own pmpro_checkout_boxes hook (priority 10). | |
| */ | |
| function my_pmpro_group_parent_existing_seats_notice() { | |
| if ( ! function_exists( 'pmprogroupacct_get_settings_for_level' ) || ! class_exists( 'PMProGroupAcct_Group' ) ) { | |
| return; | |
| } |
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 | |
| /** | |
| * Hide the "Change" link on the Membership Account page for every active member. | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_member_action_links( $pmpro_member_action_links, $level_id ) { | |
| // Unset the 'change' action link entirely | |
| if ( isset( $pmpro_member_action_links['change'] ) ) { | |
| unset( $pmpro_member_action_links['change'] ); | |
| } |
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 | |
| /** | |
| * Sync WordPress avatar into BuddyPress, with reliable size enforcement. | |
| * | |
| * @param string $avatar <img> tag or raw URL BP would return. | |
| * @param array $params Params passed to bp_core_fetch_avatar(). | |
| * @return string | |
| */ | |
| function my_pmpro_bp_sync_wordpress_avatar( $avatar, $params ) { | |
| if ( empty( $params['object'] ) || 'user' !== $params['object'] ) { |
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 | |
| /** | |
| * Set the subscription profile_start_date to the 1st of a month next year based on signup day. | |
| * Days 1–14: 1st of the current month, next year. | |
| * Days 15+: 1st of the following month, next year. | |
| * | |
| * NOTE: This is for yearly membership levels. | |
| */ | |
| function my_pmpro_set_annual_profile_start_date( $checkout_level ) { | |
| if ( ! pmpro_isLevelRecurring( $checkout_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 | |
| /** | |
| * Apply a discount code to child level at the moment of checkout | |
| * | |
| * link: TBD | |
| * | |
| * 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 | |
| /** | |
| * Move the members subscription start date based on their remaining days of current level that has an expiration date. | |
| * Note: Do not set initial payment to $0, let members pay ahead for their next billing period before starting subscriptions. | |
| * Useful for any migration where we cannot migrate the subscription and need to checkout again. | |
| */ | |
| function my_pmpro_renewal_defer_startdate( $checkout_level ) { | |
| // Only run on the frontend during checkout | |
| if ( ! function_exists( 'pmpro_getMembershipLevelForUser' ) ) { | |
| return $checkout_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 | |
| /** | |
| * 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. |
NewerOlder