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 / 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 December 22, 2023 14:19
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
@dparker1005
dparker1005 / my_pmpro_fix_taxonomy_user_field_data.php
Last active March 31, 2023 10:29
On login, loop through all user fields and check if any are taxonomy fields. If so, check the user's meta value for that field. If the taxonomy option label is stored, change it to the ID.
<?php
// Copy from below here...
/**
* On login, loop through all user fields and check if any are taxonomy fields.
* If so, check the user's meta value for that field. If the taxonomy option label
* is stored, change it to the ID.
*
* Upgrade script to go along with this bug fix PR: https://github.com/strangerstudios/paid-memberships-pro/pull/2423
@dparker1005
dparker1005 / pmpro_allowlist.php
Created March 22, 2023 14:54
Only allow specific email addresses and usernames to check out using PMPro. Forked from Register Helper.
<?php
/*
* Plugin Name: PMPro Allowlist
* Plugin URI: https://www.paidmembershipspro.com
* Description: Only allow specific email addresses and usernames to check out using PMPro. Forked from Register Helper.
* Version: 1.0
* Author: Paid Memberships Pro
* Author URI: https://www.paidmembershipspro.com
*/
@dparker1005
dparker1005 / redirect_cancel_to_stripe.php
Created March 9, 2023 18:54
Redirect users from the cancellation page to the Stripe Customer Portal.
<?php
// Copy from below here...
/**
* Prevent users from cancelling their membership or checking out for a new one.
*/
function my_pmpro_redirect_cancel_to_stripe() {
global $pmpro_pages;
if ( ! empty( $pmpro_pages['cancel'] ) && is_page( $pmpro_pages['cancel'] ) ) {