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 | |
| /** | |
| * Generate a discount code for Paid Memberships Pro. Call this function whenever you'd like to generate a new discount code. | |
| * Adjust the code accordingly for discount uses and level settings for the discount code. | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| * | |
| * www.paidmembershipspro.com | |
| */ | |
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 | |
| // Get custom taxonomy terms. | |
| $cause_categories = get_terms( array( | |
| 'taxonomy' => 'cause-category', | |
| ) ); | |
| $options = array(); | |
| foreach ( $cause_categories as $key => $category ) { | |
| $options[$category->term_id] = $category->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 | |
| /** | |
| * Allow multiple membership products to be purchased. | |
| */ | |
| function my_pmprowoo_plugins_loaded() { | |
| remove_filter( 'woocommerce_is_purchasable', 'pmprowoo_is_purchasable', 10, 2 ); | |
| } | |
| add_action( 'plugins_loaded', 'my_pmprowoo_plugins_loaded' ); |
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 | |
| /** | |
| * Redirect on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On) | |
| */ | |
| function my_pmpro_login_redirect_url( $url, $request, $user ) { | |
| // Set failed payment redirect URL here. | |
| $failed_payment_redirect_url = site_url( 'payment-failed' ); | |
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 new members purchased through WooCommerce with MailChimp | |
| */ | |
| function my_woocommerce_order_status_completed() { | |
| if ( function_exists( 'pmpromc_processSubscriptions' ) ) { | |
| pmpromc_processSubscriptions(); | |
| } | |
| } |
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 non-member messages on category archives. | |
| */ | |
| function my_the_content( $content ) { | |
| if ( is_category() ) { | |
| $content = preg_replace( '/<div class="pmpro_content_message">.*<\/div>/', '', $content ); | |
| } | |
| return $content; |
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 | |
| /** | |
| * Limit Post Views: Don't allow post views for certain categories. | |
| */ | |
| function my_pmprolpv_has_membership_access( $has_access, $post ) { | |
| // Set blocked categories here. | |
| $blocked_categories = array( 'silver', 'gold' ); | |
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 new site language based on language switcher. | |
| */ | |
| function my_pmpro_network_new_site( $blog_id, $user_id ) { | |
| if ( ! empty( $_REQUEST['WPLANG'] ) ) { | |
| switch_to_blog( $blog_id ); | |
| update_option( 'WPLANG', sanitize_text_field( $_REQUEST['WPLANG'] ) ); | |
| restore_current_blog(); |