Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 22:25 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
<?php //do not copy
function mypmpro_remove_content_changes_avada() {
remove_filter( 'the_content', 'pmpros_the_content' );
}
add_action( 'awb_remove_third_party_the_content_changes', 'mypmpro_remove_content_changes_avada', 5 );
// Add the_content restriction back for Avada.
function mypmpro_readd_content_changes_avada() {
add_filter( 'the_content', 'pmpros_the_content' );
@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' );
<?php //do not copy
/**
* This recipe will save a utm_source value when a visitor lands on the checkout
* page. This then gets stored in order meta upon successful checkout.
*
* 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 adds the pmpro_pending_approval class to the pmpro_content_message
* element if the current user is pending approval.
*
* 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 ensures that only products that are NOT on sale will be discounted
* when using the Woocommerce Add On.
* All other products will be discounted as expected.
*
* 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 will either add a fee or discount to specific variations of a Woo
* product based on the level that the user holds.
*
* In the below example, variation ID 107 should have level 1 and a fee of 1500 will be added.
* Variation ID 108 requires a level 2 and applies a discount of 8
*
* You can add this recipe to your site by creating a custom plugin
@JarrydLong
JarrydLong / pmpro-add-userfields-approvals.php
Last active February 6, 2023 14:37 — forked from kimwhite/pmpro-add-userfields-approvals.php
PMPro - Add Custom User Fields to the Admin Approval Email
<?php // don't copy this line
/**
* Adds Custom User Fields to the Approvals Email.
*
* 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/
*/