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
| /* | |
| Perform an action on PMPro recurring orders only. | |
| A recurring order here is one that | |
| (1) Has an earlier order with the same subscription_transaction_id. | |
| (2) Is not created at PMPro checkout. | |
| Note that we are checking if function_exists for pmpro_isOrderRecurring incase | |
| we add this to PMPro core. Also note that the $test_checkout param there is used | |
| here to avoid #2 above. So this parameter will check if the currently running PHP | |
| script is being fired at checkout, not necessarily if the order was created at checkout, |
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 // DO NOT COPY THIS LINE | |
| /** | |
| * Conditional field example. Display two textfields depending on checkbox value | |
| * This can be added to an existing register helper add fields code, if adding this type of field for the first time, | |
| * be sure to check if function exists by adding this: function my_pmprorh_init() { if(!function_exists( "pmprorh_add_registration_field" )) { return false; } | |
| **/ | |
| $fields[] = new PMProRH_Field( |
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
| //Enables comments for User Pages | |
| function enable_comments_for_user_pages($postdata, $user, $level) | |
| { | |
| $postdata['comment_status'] = 'open'; | |
| return $postdata; | |
| } | |
| add_filter('pmpro_user_page_postdata', 'enable_comments_for_user_pages', 10, 3); |
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 // do not copy this line | |
| /** | |
| * This gist is to add a 20% fee on all orders and rename 'Tax' to 'VAT Fees'. | |
| * Please add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| * www.paidmembershipspro.com | |
| */ | |
| /** | |
| * This function will add 20% to all orders using the 'pmpro_tax' filter. |
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 "Pay by Check" language to "Pay by Wire Transfer" | |
| Add this code to your active theme's functions.php | |
| or a custom plugin. | |
| */ | |
| function my_gettext_pay_by_check($translated_text, $text, $domain) | |
| { | |
| if($domain == "pmpropbc" && $text == "Pay by Check") |
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 // DO NOT COPY THIS LINE | |
| /** | |
| * Redirect all non-admin user's after they login to your website's home page. | |
| * Documentation for login_redirect filter - https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect | |
| */ | |
| function pmpro_redirect_after_login( $redirect_to, $request, $user ) { | |
| if ( isset( $user->roles ) && is_array( $user->roles ) ) { |
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 | |
| /* | |
| Replace or translate text strings that's not translatable with gettext. | |
| */ | |
| // Check page content and replace text strings | |
| function my_change_text_gift_addon( $text ) { | |
| global $pmpro_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
| function my_pmpro_checkout_level($level) | |
| { | |
| $current_day = date('j'); | |
| $days_in_month = date('t'); | |
| $level->initial_payment = $level->initial_payment*(($days_in_month - $current_day)/$days_in_month); | |
| return $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 // DO NOT COPY THIS LINE, it will trigger a fatal error. Copy from below please! | |
| /* | |
| * Bcc admin on specific email templates only | |
| * more then one can be added like this: | |
| * $headers[] = "Bcc:" . "otheremail@domain.com,anotheremail@domain.com"; | |
| * You can change the conditional to check for a certain $email->template or some other condition before adding the BCC. | |
| * Please add the below code to your site by following this guide: | |
| * https://www.paidmembershipspro.com/how-to-add-code-to-wordpress/ | |
| */ |
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 | |
| /* PMPro Gift Levels Example - See full information here: https://www.paidmembershipspro.com/add-ons/pmpro-gift-levels/*/ | |
| global $pmprogl_gift_levels; | |
| $pmprogl_gift_levels = array( | |
| // Also, set level 9 as a "Purchase Gift" membership level to create a customized level 10 gift. | |
| 9 => array( |