Skip to content

Instantly share code, notes, and snippets.

Avatar

David Parker dparker1005

  • Stranger Studios
View GitHub Profile
@dparker1005
dparker1005 / disable_pmpropbc_send_invoice_email.php
Created Sep 2, 2021
Disables sending a invoice emails for check orders whenever an order is saved in success status.
View disable_pmpropbc_send_invoice_email.php
<?php
/**
* Disables sending a invoice emails for check orders whenever an order is saved
* in success status.
*
* 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/
@dparker1005
dparker1005 / my_pmpro_cron_expiration_warnings_filter_next_payments.php
Created Aug 16, 2021
Fetch next payment dates from payment gateways during the expiration warnings cron. This also affects emails sent by the PMPro Recurring Emails Add On.
View my_pmpro_cron_expiration_warnings_filter_next_payments.php
<?php
/**
* Fetch next payment dates from payment gateways during the expiration warnings cron. This
* also affects emails sent by the PMPro Recurring Emails Add On.
*/
function my_pmpro_cron_expiration_warnings_filter_next_payments() {
add_filter('pmpro_next_payment', array('PMProGateway_paypalexpress', 'pmpro_next_payment'), 10, 3);
add_filter('pmpro_next_payment', array('PMProGateway_braintree', 'pmpro_next_payment'), 10, 3);
}
@dparker1005
dparker1005 / my_pmpro_set_application_fee_percentage.php
Last active Aug 12, 2021
Modify the application fee percentage that is charged on Stripe transactions.
View my_pmpro_set_application_fee_percentage.php
<?php
/**
* Modify the application fee percentage that is charged on Stripe transactions.
*
* 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/
*/
@dparker1005
dparker1005 / my_pmpro_after_all_membership_level_changes_sample.php
Last active Aug 4, 2021
Sample code for using the pmpro_after_all_membership_level_changes action.
View my_pmpro_after_all_membership_level_changes_sample.php
<?php
/**
* Sample code for using the pmpro_after_all_membership_level_changes action.
*
* @param array $old_user_levels $user_id => array $old_levels
*/
function my_pmpro_after_all_membership_level_changes_sample( $old_user_levels ) {
// Step 1: Loop through $old_user_levels.
foreach ( $old_user_levels as $user_id => $old_levels ) {
@dparker1005
dparker1005 / my_pmproz_after_checkout_data_discount_code.php
Created Jul 15, 2021
Sends the discount code used to Zapier on the After Checkout trigger.
View my_pmproz_after_checkout_data_discount_code.php
<?php
// Copy from below here...
/**
* Sends the discount code used to Zapier on the After Checkout trigger.
*
* 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.
@dparker1005
dparker1005 / pmpro_profile_start_date_from_expiration.php
Created Jul 13, 2021
When a user with an enddate renews for a recurring subscription for the same level, do not charge the initial payment and set the first recurring payment date for their old enddate.
View pmpro_profile_start_date_from_expiration.php
<?php
/**
* When a user with an enddate renews for a recurring subscription for the same level,
* do not charge the initial payment and set the first recurring payment date for their
* old enddate.
*
* 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/
@dparker1005
dparker1005 / my_pmpro_checkout_before_submit_button_hide_ppe.php
Created Jul 6, 2021
Hide PayPal button if user is not approved to check out for this level.
View my_pmpro_checkout_before_submit_button_hide_ppe.php
<?php
/**
* Hide PayPal button if user is not approved to check out for this level.
*
* 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/
*/
@dparker1005
dparker1005 / my_pmpro_member_profile_edit_user_object_fields_add_join_date.php
Created Jul 1, 2021
Show the date that the user joined on their frontend profile page.
View my_pmpro_member_profile_edit_user_object_fields_add_join_date.php
<?php
/**
* Show the date that the user joined on their frontend profile page.
*
* 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/
*/
@dparker1005
dparker1005 / my_pmpro_require_email_confirmation_for_checkout.php
Created Jun 8, 2021
Require user to confirm there email address before checking out for specific levels.
View my_pmpro_require_email_confirmation_for_checkout.php
<?php
/*
* Require user to confirm there email address before checking out for specific levels.
* Can build a free level requiring email confirmation for users to sign up for before the "real" levels.
*
* 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/
@dparker1005
dparker1005 / pmpro_convert_currency.php
Last active Jun 5, 2021
Automatically updates the cost of a membership level to be the local currency amount equivalent to a defined price in a different currency.
View pmpro_convert_currency.php
<?php
// Copy from below here...
/**
* Automatically updates the cost of a membership level to be the local currency amount
* equivalent to a defined price in a different currency.
*
* For example, the default setup below will get the conversion rate from USD to ZAR
* every day and use that information to set the membership price for level ID 5