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 / fill_empty_check_order_toatals.sql
Last active November 21, 2024 14:16
SQL query to help fix sites affected by this Pay By Check bug: https://github.com/strangerstudios/pmpro-pay-by-check/pull/131. Update total, subtotal, and membership_id accordingly.
/*
Query to help sites affected by this PMPro Pay By Check bug:
https://github.com/strangerstudios/pmpro-pay-by-check/pull/131
This will set all $0 check orders for a specific level to have a specific total.
This will not account for variable pricing such as donations or discount code uses.
Before executing this query, set membership_id to the level that you would like to fix
and total and subtotal to the recurring price for that level.
@dparker1005
dparker1005 / only_send_recurring_email_for_long_payment_periods.php
Created August 7, 2024 16:40
Only send recurring payment reminder when the last subscription payment was over 6 months ago.
<?php
/**
* Only send recurring payment reminder when the last subscription payment was over 6 months ago.
*
* 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_custom_template_path_use_default.php
Created April 2, 2024 13:33
Use the default PMPro checkout page template instead of a custom theme tempalate.
<?php
/**
* Use the default PMPro checkout page template instead of a custom theme tempalate.
*
* 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 / memberslist_billing_address.php
Created February 28, 2024 16:12
Add the "billing address" column back to the members list and CSV export.
<?php
/**
* Add the "billing address" column back to the members list and CSV export.
*
* Note: This will add the most recent billing address for the user and level
* by looking at the user's order history, not user meta.
*
* 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 / my_remove_pmpro_search_filter_pmpro_pages.php
Last active February 23, 2024 20:20
Disable hiding PMPro pages from search.
<?php
/**
* Disable hiding PMPro pages from search.
*
* 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_stripe_checkout_session_parameters_subscription_description.php
Last active February 5, 2025 13:13
Updates the payment description in Stripe when purchasing a subscription using Stripe Checkout.
<?php
/**
* 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.
*/
// Copy from below this line
/**
@dparker1005
dparker1005 / redirect_logged_out_users_from_post.php
Created October 23, 2023 13:48
Redirect logged out users from a specific post to the site's login page.
<?php
// Copy below this line.
/**
* Redirect logged out users from a specific post to the site's login 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.
@dparker1005
dparker1005 / my_pmpromh_prioritized_levels.php
Created October 12, 2023 19:30
Set the level order in which the PMPro Member Homepages Add On should try to redirect members to the corresponding homepage.
<?php
/**
* 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.
*/
// Copy from below this line.
/*
@dparker1005
dparker1005 / rwstripe-trials.php
Last active June 9, 2023 17:29
Give new customers a free trial when purchasing a subscription.
<?php
/**
* 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.
*/
// Copy from below this line
/**
@dparker1005
dparker1005 / pmpro_discount_messages.php
Last active April 7, 2023 15:37
Checks if a certain discount code was used in the checkout and shows messages in multiple places.
<?php
// Copy from below here...
/**
* Checks if a certain discount code was used in the checkout and:
* - Shows a special message on the Confirmation page
* - Includes a special message in the Confirmation email
* - Shows a message on the Invoice for that order/checkout
* - Shows a message on the Account page if the most recent order used the code in the past week