Skip to content

Instantly share code, notes, and snippets.

View dparker1005's full-sized avatar

David Parker dparker1005

  • Stranger Studios
View GitHub Profile
@dparker1005
dparker1005 / my_pmpro_cron_expiration_warnings_filter_next_payments.php
Created August 16, 2021 14:27
Fetch next payment dates from payment gateways during the expiration warnings cron. This also affects emails sent by the PMPro Recurring Emails Add On.
<?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 August 12, 2021 21:13
Modify the application fee percentage that is charged on Stripe transactions.
<?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 August 4, 2021 19:11
Sample code for using the pmpro_after_all_membership_level_changes action.
<?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 July 15, 2021 18:30
Sends the discount code used to Zapier on the After Checkout trigger.
<?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 July 13, 2021 14:33
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.
<?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 July 6, 2021 14:43
Hide PayPal button if user is not approved to check out for this level.
<?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 July 1, 2021 15:27
Show the date that the user joined on their frontend profile page.
<?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 June 8, 2021 15:37
Require user to confirm there email address before checking out for specific levels.
<?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 June 5, 2021 13:12
Automatically updates the cost of a membership level to be the local currency amount equivalent to a defined price in a different currency.
<?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
@dparker1005
dparker1005 / my_pmproza_change_level.php
Last active October 4, 2023 09:54
Modify memberships that are given to users via Zapier. As written, this will change the billing amount shown to $10/year.
<?php
// Copy from below here...
/**
* Modify memberships that are given to users via Zapier.
* As written, this will change the billing amount shown to $10/year.
*
* 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.