Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 00:18 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
<?php // do not copy
/**
* Set membership expiration based on membership year.
* Membership year: Sept 1 – Aug 31
* Renewal window: Jul 1 – Aug 31
*
* 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 hide any products from the Woo store if the current member
* does not have access to the product with a level restriction
*
* 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 forward all requests from a temporary webhook URL
* to the current PMPro Stripe Webhook URL
*
* 1. Navigate to Memberships > Settings > Payment Gateway and Edit Settings on the Stripe Gateway
* 2. Disable your webhook - do not create a new one
* 3. Login to your Stripe account, navigate to Webhooks
* 4. Create a new webhook with the URL of https://MYSITE.com/?pmpro-api=stripe_webhook
* 5. For testing purposes, enable all Stripe events
<?php //do not copy
/* This recipe send additional data to Kit to populate custom fields
*
* 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 add a tag ID to the list of subscriber tags.
* Use the $user object to add this information conditionally
*
* 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
/**
* Redirect users to login page after logging out of WordPress.
*/
function my_redirect_after_logout_wp(){
wp_redirect( "/login" );
exit;
}
add_action('wp_logout','my_redirect_after_logout_wp');
@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 ) {
<?php //do not copy
/* This recipe will show a list of 'overdue' memberships if the level is within a grace period
*
* Assign a grace period to members here: https://www.paidmembershipspro.com/add-a-grace-period/
*
* 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 redirect a member after checkout to their invoice
*
* 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
function my_pmpro_members_list_csv_extra_columns( $columns ) {
$columns["member_profile_url"] = "my_extra_column_member_url";
return $columns;
}
add_filter("pmpro_members_list_csv_extra_columns", "my_pmpro_members_list_csv_extra_columns", 10);