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 / next_last_payment_dates_members_list.php
Last active August 10, 2023 15:38 — forked from kimcoleman/next_last_payment_dates_members_list.php
Adds last payment date and next payment date to the members list and export CSV in Paid Memberships Pro (PMPro).
<?php
/**
* Adds last payment date and next payment date to the members list and export CSV.
* Note that "last payment" value will get the last order in "success", "cancelled", or "" status. (Oddly enough, cancelled here means that the membership was cancelled, not the order.)
*
* The "next payment" value is an estimate based on the billing cycle of the subscription and the last order date. It may be off from the actual recurring date set at the gateway, especially if the subscription was updated at the gateway.
*
* 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 / my_pmprosm_create_sponsor_code_if_needed.php
Last active May 18, 2023 13:00
When a user logs in, check if they have a sponoring level but don't have a sponsor code. If this is the case, create one.
<?php
// Copy from below here...
/**
* When a user logs in, check if they have a sponoring level but don't have
* a sponsor code. If this is the case, create one.
*
* IMPORTANT: If your sponsored members code is set up setting `seats` instead of
* `max_seats`, this code will need to be udpated accordingly.
@dparker1005
dparker1005 / my_pmproap_keep_membership_subscription_linked.php
Created May 26, 2022 13:21
Keeps Stripe subscription attached to membership level after purchasing an Addon Package.
<?php
/**
* Keeps Stripe subscription attached to membership level after purchasing an Addon Package.
*
* 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 / ensure_MemberInvoice_loaded.php
Last active March 14, 2022 18:26
Make sure that the MemberInvoice class is loaded when using MMPU.
<?php
// Copy from below here...
/**
* Make sure that the MemberInvoice class is loaded when using MMPU.
*
* 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 / member_since_profile_field.php
Created March 8, 2022 16:34
Adds a "Member Since:" field to the WP admin profile.
<?php
// Copy from below here...
/**
* Adds a "Member Since:" field to the WP admin profile.
*
* 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 / load-pmpro-stripe-library.php
Last active February 24, 2022 16:49
Make sure that PMPro loads the Stripe library first if other plugins are loading outdated versions on every page load.
<?php
/**
* Make sure that PMPro loads the Stripe library first if other plugins are loading outdated
* versions on every page load. This is a blunt way to address the conflict and should be used
* with caution.
*
* To use, add as a new file in your site's `wp-content/mu-plugins/` folder.
*/
if ( file_exists( dirname( __FILE__ ) . "/../plugins/paid-memberships-pro/includes/lib/Stripe/init.php" ) && ! class_exists( "Stripe\Stripe" ) ) {
@dparker1005
dparker1005 / stripe_customer_portal.php
Last active October 4, 2024 18:45
Have users update their billing information in Stripe Customer Portal.
<?php
// Copy from below here...
/**
* Have users update their billing information in Stripe Customer Portal.
*
* NOTE: Before using Stripe Customer Portal, you must first enable it by saving the
* customer portal settings page here:
* https://dashboard.stripe.com/settings/billing/portal (For live mode)
@dparker1005
dparker1005 / my_pmpro_admin_reports_max_sale_prices.php
Created January 31, 2022 18:28
Increases the number of prices shown in the "Sales and Revenue" report widget to 10.
<?php
// Copy from below here...
/**
* Increases the number of prices shown in the "Sales and Revenue" report
* widget to 10.
*
* 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.
@dparker1005
dparker1005 / filter_pmpro_send_200_http_response.php
Created November 8, 2021 15:47
Disables the `pmpro_send_200_http_response()` function.
<?php
// Copy from below here...
/**
* Disables the `pmpro_send_200_http_response()` function.
*
* That function was implemented in PMPro v2.6.4 to allow IPN/webhook
* handlers to adknowledge the receipt of a webhook before processing
* it in order to avoid timeout issues at the gateway.
@dparker1005
dparker1005 / disable_pmpropbc_send_invoice_email.php
Created September 2, 2021 13:57
Disables sending a invoice emails for check orders whenever an order is saved in success status.
<?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/