Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 06:13 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@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' );
@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/
*/
@JarrydLong
JarrydLong / pmpro-australia-gst.php
Last active January 19, 2023 09:28 — forked from ideadude/pmpro-australia-gst.php
Paid Memberships Pro - Australia GST
<?php
/*
Plugin Name: Paid Memberships Pro - Australia GST
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-australia-gst/
Description: Apply Australia GST to Checkouts with PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@JarrydLong
JarrydLong / my-template-redirect-example.php
Created November 14, 2022 06:13 — forked from andrewlimaza/my-template-redirect-example.php
Redirect non-members to homepage but allow access to PMPro checkout pages.
<?php
/**
* Redirect non-members (including logged-in non-members) away from restricted pages and to login page.
* This allows non-members to access Paid Memberships Pro checkout/levels pages as well as the default WordPress login page.
*
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_redirect_non_members_example() {
@JarrydLong
JarrydLong / change-we-accept-checkout-text.php
Last active November 7, 2022 08:17 — forked from andrewlimaza/change-we-accept-checkout-text.php
Change the We Accept Checkout Text for Paid Memberships Pro.
<?php
/**
* Change the "We Accept..." text on the checkout page.
* Follow this guide to add custom code to your membership site - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function change_my_pmpro_account_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'We accept all major credit cards' :
@JarrydLong
JarrydLong / my-pmpro-send-discount-code-for-expired-members.php
Last active June 20, 2022 08:41 — forked from andrewlimaza/my-pmpro-send-discount-code-for-expired-members.php
Generate a discount code and email it to expired members only.
<?php
/**
* This generates an unique discount code with one use whenever a user expires, for their current level.
* Add the variable !!expired_code!! to the Membership Expired email, to show the code to users.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_create_discount_code_on_expiry( $user_id, $level_id ) {
if( $level_id === 2 ) { // change 2 to your trial level