Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 19:00 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@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 ) {
@JarrydLong
JarrydLong / stop-pmpro-members-from-buying-woocommerce.php
Last active November 26, 2025 07:55 — forked from andrewlimaza/stop-non-pmpro-members-from-buying-woocommerce.php
Make certain WooCommerce products not-purchasable for non-members
<?php
/**
* Stop non-members from purchasing products if they do not have an active Paid Memberships Pro Level.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function stop_pmpro_members_from_buying_woo( $is_purchasable, $product ) {
// Check if the user has an active membership level.
@JarrydLong
JarrydLong / send-notifications-on-profile-update.php
Created February 3, 2026 12:43 — forked from MaximilianoRicoTabo/send-notifications-on-profile-update.php
Send a custom notification when a user changes their profile
<?php //do not copy
/**
* Hook into profile update and send a notification to site admin
*
* @param int $user_id The ID of the user being updated
* @param object $old_user_data The object of the user before it was updated.
* @return void
*/
function my_pmpro_profile_update_notification( $user_id, $old_user_data ) {