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 recipe will add a fee to the initial and recurring value when using Stripe | |
| * | |
| * 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/ | |
| */ | |
| function my_pmpro_checkout_level( $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 | |
| /** | |
| * We'll add in a check to see which membership level was purchased. | |
| * We can then specify which webhook each level should send data to. | |
| * If it doesn't meet the criteria of our check, we'll use the default | |
| * in the settings page. | |
| * That URL is then added to the $data array | |
| */ | |
| function mypmpro_multiple_zapier_webhooks_after_order( $data, $order, $user_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
| function disqus_embed($disqus_shortname) { | |
| global $post; | |
| wp_enqueue_script('disqus_embed','http://'.$disqus_shortname.'.disqus.com/embed.js'); | |
| echo '<div id="disqus_thread"></div> | |
| <script type="text/javascript"> | |
| var disqus_shortname = "'.$disqus_shortname.'"; | |
| var disqus_title = "'.$post->post_title.'"; | |
| var disqus_url = "'.get_permalink($post->ID).'"; | |
| var disqus_identifier = "'.$disqus_shortname.'-'.$post->ID.'"; | |
| </script>'; |
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
| /** | |
| * This gist will disable the default behavior in PMPro BuddyPress 5.2.5 or earlier, | |
| * which would redirect users away from the BP profile pages if you had | |
| * "all of BuddyPress" locked down for non-members or members of a specific level. | |
| * | |
| * We might address this in future versions of the Add-On, but for now, you can use | |
| * this gist. Add it to a Code Snippet or a custom plugin. | |
| */ | |
| // First disable the default PMPro BuddyPress behavior. |
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 mypmpro_init_remove_filters(){ | |
| remove_filter("pmpro_email_body", "pmprosm_pmpro_email_body", 10, 2); | |
| } | |
| add_action( 'init', 'mypmpro_init_remove_filters' ); | |
| /* | |
| Add code to confirmation email. | |
| */ | |
| function mypmpro_adjusted_pmpro_email_body($body, $pmpro_email) |
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 mypmpro_add_email_fields( $data, $object ){ | |
| global $pmprosm_sponsored_account_levels; | |
| $data['sponsored_note'] = ""; | |
| $data['seats'] = ""; | |
| if( $object->data ){ | |
| $membership_id = intval( $object->data['membership_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 | |
| function my_pmpro_levels_array($levels){ | |
| global $post; | |
| if( isset( $post->ID ) ){ | |
| $specific_pages = array( 10 ); // Which pages should the hidden levels apply to? | |
| if( in_array( $post->ID, $specific_pages ) ){ |
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 mypmpro_before_change_membership( $level_id, $user_id, $old_levels, $cancel_level ){ | |
| global $wpdb; | |
| if( $cancel_level !== null || $level_id == 0 ){ | |
| $uses = 1; | |
| $level_id = 1; | |
| $code = "P" . pmpro_getDiscountCode(); |
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
| /* | |
| Use a custom checkout_renewal.html email template for renewals. | |
| Add this code to a custom plugin. | |
| Make sure there is a folder /email/ in the plugin folder. | |
| Add a file /email/checkout_renewal.html in that email folder. | |
| */ | |
| function my_pmpro_email_checkout_renewal($email) { |
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
| /* | |
| * Give members of level 1 or 2 Free Shipping when free shipping is available (must set free shipping as an option in store settings). | |
| * Change $pmprowc_free_shipping_levels = array(1,2); to include level IDs that receive free shipping | |
| */ | |
| function my_pmprowc_free_shipping( $rates, $package ) { | |
| $pmprowc_free_shipping_levels = array( '1', '2' ); | |
| $free_shipping_key = ""; | |
| foreach( $rates as $key => $val ){ | |
| if( strpos( $key, 'free_shipping' ) !== false ){ |