Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 03:46 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@JarrydLong
JarrydLong / pmpro-user-fields-default-value.php
Last active December 19, 2024 09:29 — forked from ipokkel/pmpro-user-fields-default-value.php
Set default field values for PMPro User Fields.
<?php
/**
* Set default values for PMPro user fields.
*
* Supported field types: text, textarea, checkbox, radio, select, select2, multiselect, number, and date.
* Can support readonly and hidden fields, however, they will not be editable by the user.
*
* 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 / my_pmpro_prevent_renewal.php
Created November 28, 2023 10:28 — forked from kerijacoby/my_pmpro_prevent_renewal.php
Remove 'Renew' link and prevent checkout if user already has membership level
<?php
// Copy from below here.
add_action('pmpro_is_level_expiring_soon', '__return_false', 10, 2);
// Check if they have a specific level, and prevent them from signing up for a specific level
function my_pmpro_prevent_renewal( $continue ) {
global $pmpro_level;
@JarrydLong
JarrydLong / logout_url_redirect_pmpro.php
Created September 14, 2023 19:01 — forked from dparker1005/logout_url_redirect_pmpro.php
Redirect logout to PMPro login page.
<?php
// Copy from below here...
/*
* Redirect logout to PMPro login page.
*/
function my_logout_url_redirect_pmpro( $logout_url ) {
global $pmpro_pages;
if ( ! empty( $pmpro_pages['login'] ) ) {
@JarrydLong
JarrydLong / my-pmpro-confirmation-message.php
Created August 21, 2023 13:27 — forked from ipokkel/my-pmpro-confirmation-message.php
Create a custom confirmation with a custom message
<?php
/**
* This recipe changes the default confirmation message when a user checks out.
*
*
* 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/
@JarrydLong
JarrydLong / change-email-for-pmpro-locales.php
Created August 1, 2023 14:55 — forked from andrewlimaza/change-email-for-pmpro-locales.php
Translate Email / Change email content based on different locale for PMPro.
<?php
/**
* Adjust email content based on locale used on checkout. Works with WPML plugin.
* This requires a couple of steps to get working.
* 1. Inside your PMPro Customizations Plugin, create a folder called email_fr_FR
* (You may change fr_FR to the locale your site will be serving besides the default locale - create as many folders that you need).
* 2. Copy the email templates from 'wp-content/plugins/paid-memberships-pro/email' and paste them into your email_fr_FR folder created above.
* 3. Manually edit each template with the translation of the emails or adjust the email template to your liking.
* 4. Repeat these steps for each email folder you created depending on the number of locales your site is using.
@JarrydLong
JarrydLong / pmpro-expire-soon-banner.php
Created July 17, 2023 13:22 — forked from kimcoleman/pmpro-expire-soon-banner.php
Create a banner that will display a message to soon to be expiring members
<?php
/**
* This code will display a renewal reminder notification banner at the top of your website for members whose membership
* level will expire within 7 days of the date they visit your site.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*/
function pmpro_show_banner_renewal_message() {
global $pmpro_pages;
@JarrydLong
JarrydLong / memberlite-banner-expiration-notification.php
Last active July 17, 2023 13:22 — forked from kimcoleman/memberlite-banner-expiration-notification.php
Display a banner that notifies users about their upcoming expiration - Memberlite method.
<?php
/**
* This code will display a renewal reminder notification banner at the top of your website for members whose membership
* level will expire within 7 days of the date they visit your site.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*/
function memberlite_show_banner_renewal_message(){
global $pmpro_pages;
@JarrydLong
JarrydLong / my_pmpro_custom_tax_example.php
Last active May 16, 2023 10:41 — forked from strangerstudios/my_pmpro_custom_tax_example.php
Custom tax structure for Paid Memberships Pro where level 1 has no tax and all other levels have 7.25% tax if billing state is CA.
<?php
/*
Custom Tax Example.
- Requires PMPro 1.3.13 or higher.
- Leave the tax fields blank in the payment settings.
- Level 1 has no tax.
- Other levels have 7.25% tax for CA customers only.
- We update the price description to include the tax amount.
*/
function my_pmpro_tax($tax, $values, $order)
@JarrydLong
JarrydLong / pmpro-ipn-redirect.php
Last active May 1, 2023 10:32 — forked from andrewlimaza/pmpro-ipn-redirect.php
Post IPN data to multiple URLs example [Paid Memberships Pro]
<?php
/**
* Forward IPN requests from WooCommerce PayPal Standard to also send to Paid Memberships Pro.
* Please change the URL on line 9 to match that of your Paid Memberships Pro site URL.
* Follow this guide to add this to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_forward_ipn() {
if ( isset( $_REQUEST['callback'] && $_REQUEST['callback'] == 'gravityformspaypal' ) {
$fp = wp_remote_post( 'https://saac-arts.org/wp-admin/admin-ajax.php?action=ipnhandler', $_POST );
}
@JarrydLong
JarrydLong / change-expiration-until-cancelled.php
Created March 22, 2023 08:31 — forked from andrewlimaza/change-expiration-until-cancelled.php
Change Expiration Text From "---" to "Until Cancelled"
<?php
/**
* Change the account page expiration text to "Until Cancelled"
* for never expiring levels/members.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_adjust_expiration_text( $expiration_text, $level ) {
if ( strpos( $expiration_text, '&#8212;' ) !== false) {
$expiration_text = __( 'Until Cancelled', 'paid-memberships-pro' );