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 | |
| /** | |
| * Use a default discount code for the PMPro checkout page. | |
| * Change the DEFAULT code to the one you want to use. | |
| * You could alter this to check the $pmpro_level global to | |
| * do this only for certain levels. | |
| * You could add other logic to exclude existing customers/etc. | |
| * Add this code to a custom plugin or Code Snippet. | |
| */ | |
| function my_default_pmpro_discount_code() { |
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
| /** | |
| * Update RH fields after they've been setup. | |
| * The example below sets the addmember property to true. | |
| * Add this code to a custom plugin or Code Snippet. | |
| */ | |
| function my_update_rh_fields() { | |
| global $pmprorh_registration_fields; | |
| if ( empty( $pmprorh_registration_fields ) ) { | |
| 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
| /** | |
| * When a user is given a level, give add that user to another site | |
| * in the network and give them a level there too. | |
| * PMPro should be active on both blogs. | |
| * The other blog should have the membership level already setup, note the ID. | |
| * Blog/site IDs can be found in the Sites page of the network dashboard. | |
| * This is not mean to work with the other PMPro multisite add ons. | |
| * Add this to a custom plugin or as a Code Snippet on your site. | |
| * 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 | |
| /** | |
| * Tell PMPro to look for templates in this plugin's templates/ folder. | |
| */ | |
| function my_pmpro_pages_custom_template_path( $templates, $page_name ) { | |
| $templates[] = plugin_dir_path(__FILE__) . 'templates/' . $page_name . '.php'; | |
| return $templates; | |
| } | |
| add_filter( 'pmpro_pages_custom_template_path', 'my_pmpro_pages_custom_template_path', 10, 2 ); |
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
| # BACKUP FIRST | |
| # This SQL query will set the expiration date | |
| # to 2020-01-01 for any active membership with | |
| # a different current enddate. | |
| # BACKUP FIRST | |
| UPDATE wp_pmpro_memberships_users | |
| SET enddate = '2020-01-01 00:00:00' | |
| WHERE status = 'active' | |
| AND enddate IS NOT NULL | |
| AND enddate <> '0000-00-00 00:00:00' |
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 | |
| /* | |
| * Filter membership level names and descriptions for translating. | |
| * | |
| * Add this code to a custom plugin or your active theme's functions.php file. | |
| * Be sure to update the $pmpro_translated_levels array. Add a sub array for each locale. | |
| * The sub array keys should be the membership level ids, | |
| * and values should be an array with the name and description to translate to. | |
| * | |
| */ |
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 | |
| /** | |
| * Donation notes. | |
| * Edit the copy below. | |
| * Add to a custom plugin. | |
| * Notes are saved into the notes field of the order. | |
| */ | |
| // show the notes field at checkout. | |
| function my_pmprodon_donation_notes() { | |
| global $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 code should be placed into context of adding RH fields | |
| // like this: https://www.paidmembershipspro.com/documentation/register-helper-documentation/code-examples/ | |
| //define the fields | |
| $fields = array(); | |
| $fields[] = new PMProRH_Field( | |
| 'budget', // input name, will also be used as meta key | |
| 'select', // type of field | |
| array( |
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 | |
| /** | |
| * Always send the checkout_free confirmation email | |
| * when changing a user's level in the admin dashboard. | |
| */ | |
| function my_send_pmpro_confirmation_emails_from_dashboard( $level_id, $user_id, $cancel_level_id ) { | |
| // If we're not in the dashboard, this is probably a checkout on the frontend | |
| if ( ! is_admin() ) { | |
| 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
| /** | |
| * Alternative loadStripeLibrary() method that will die and output | |
| * the location of the file that previously loaded a different version | |
| * of the Stripe API library. | |
| * | |
| * THIS CODE IS FOR DEBUGGING PURPOSES ONLY | |
| * | |
| * Find the loadStripeLibrary() method of classes/gateways/class.pmprogateway_stripe.php | |
| * and replace with this version. Then attempt to checkout and take note. | |
| */ |