This file contains 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 | |
/** | |
* Add phone number to the data array sent to Zapier | |
* when a new PMPro order is made. | |
* | |
* This gist requires the pmpro-zapier plugin. | |
* For information on how to add code snippets: https://www.paidmembershipspro.com/how-to-add-code-to-wordpress/ | |
*/ | |
function my_pmproz_added_order_data_add_phone( $data, $order, $user_id ) { | |
$data['phonenumber'] = get_user_meta( $user_id, 'pmpro_bphone', true ); |
This file contains 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
/* Remove the level fee column */ | |
#pmpro_account-membership table.pmpro_table .pmpro_account-membership-levelfee { | |
display: none; | |
} | |
#pmpro_account-membership table.pmpro_table tr th:nth-child(1) { | |
display: none; | |
} |
This file contains 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 expiration text on the levels page with PMPro. | |
* Add this code into a custom plugin or code snippet. | |
*/ | |
function my_hide_expiration_text_on_levels_page( $text ) { | |
global $pmpro_pages; | |
if ( ! empty( $pmpro_pages['levels'] && is_page( $pmpro_pages['levels'] ) ) ) { | |
$text = ''; | |
} |
This file contains 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 | |
/** | |
* Send extra expiration warning emails with individual templates. | |
* Make sure the Extra Expiration Warning Emails Add On is also active. | |
* https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/ | |
* | |
* Then add this code into a custom plugin or code snippet. | |
* https://www.paidmembershipspro.com/how-to-add-code-to-wordpress/ | |
*/ | |
// Tell the expiration warnings add on to use our templates. |
This file contains 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 | |
/** | |
* Automatically approve any previously approved member. | |
* Requires the PMPro Approval Process for Membership Add On - https://www.paidmembershipspro.com/add-ons/approval-process-membership/ | |
* Add this code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_automatically_approve_previously_approved( $level_id, $user_id, $cancelled_level ) { | |
if ( ! class_exists( 'PMPro_Approvals' ) ) { |
This file contains 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
/** | |
* Prorate the initial payment at PMPro checkout based on the day of the month. | |
* You should use the Subscription Delays add on to set your subscription | |
* to delay until Y1-M1-01. | |
*/ | |
function my_pmpro_checkout_level( $level ) { | |
$current_day = date( 'j' ); | |
// Ignore if it's the first of the month. | |
if ( $current_day == 1 ) { |
This file contains 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
# successful paid orders for a given month | |
SELECT COUNT( * ) | |
FROM wp_pmpro_membership_orders | |
WHERE | |
total > 0 AND | |
status NOT IN ( | |
'error', 'token', 'refunded', 'pending', 'review' | |
) | |
AND TIMESTAMP > '2017-10-01' | |
AND TIMESTAMP < '2017-11-01'; |
This file contains 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 | |
/** | |
* Update the PMPro Courses Lessons CPT to have a frontend archive page. | |
* Add this code into a custom plugin or Code Snippet. | |
* After adding this code, visit Settings -> Permalinks and save to | |
* 'flush the rewrite rules'. | |
* Then visit /lessons/ on your site. | |
* You can style this archive by adding a file named archive-pmpro_lesson.php | |
* to your child theme or theme. | |
*/ |
This file contains 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 filter will search your codebase for translatable strings and replace when an exact match is found. | |
* | |
* Here we're changing 'Membership' to 'Subscription' for Paid Memberships Pro. | |
* | |
* Add this code to your PMPro Customizations Plugin | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above. | |
* |
This file contains 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 handles loading a file from one or more protected directories. | |
This is a variation of the code presented here: | |
https://www.paidmembershipspro.com/locking-non-wordpress-files-folders-paid-memberships-pro/ | |
(!) Be sure to change the $protected_directories arary below. | |
(!) Add this code to a code snippet or custom plugin. | |
(!) You should have a corresponding bit of code in your Apache .htaccess file | |
to redirect files to this script. You need one line per protected dir. | |
### |