Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 05:17 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
<?php
/**
* Override the Geocoding API key to a private key. This helps if you want to restrict
* usage of the Geocoding API key. This key is not public like the JS Map API Key.
*
* To be used with Member Directory 2.1+
*
* 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.
@JarrydLong
JarrydLong / pmpro_level_expiring_soon_example.php
Last active October 8, 2025 10:12 — forked from andrewlimaza/pmpro_level_expiring_soon_example.php
Change when user can renew their membership PMPro
<?php
/**
* Allow members to only renew if their membership expires in 45 days or less.
* Only do this for levels that are not recurring.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function custom_pmpro_is_level_expiring_soon( $r, $level ) {
if( $level->billing_amount > 0 ) {
<?php //do not copy
/**
* This recipe will set the initial amount to the billing amount for a member
* that has an expiration date and is renewing.
*
*/
function my_pmpro_change_initial_amount_existing_members( $level ) {
@JarrydLong
JarrydLong / my_pmpro_no_access_message_body.php
Last active September 24, 2025 08:54 — forked from dwanjuki/my_pmpro_no_access_message_body.php
Custom no access message that includes membership level names
<?php
/**
* Custom "no access" message
*
* 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/
*/
function my_pmpro_custom_no_access_message_body( $body, $required_level_ids ) {
<?php //do not copy
/**
* This recipe increases the orders and members limit used in the REST API endpoints
*
* 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/
*/
<?php //do not copy
/**
* This recipe will set the initial amount to the billing amount for a level
* that the current logged in user has held a level of before.
*
* 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/
*/
<?php //do not copy
/**
* This recipe will show either the last level a member had, or if they're a new member.
*
* Use the !!old_level_name!! variable in an email template.
*
* 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.
<?php //do not copy
/**
* This recipe removes the redirect referrer from the Login URL in the No Access message
*
* 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.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
<?php //do not copy
/**
* Removes the Map address fields from the checkout page
* when using Member Directory 2.1+
*/
function mypmpro_remove_map_fields_checkout() {
remove_action( 'init', 'pmpromd_add_user_fields' );
}