Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 09:59 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@JarrydLong
JarrydLong / my_pmpro_fix_warning.php
Last active August 9, 2021 09:03 — forked from dparker1005/my_pmpro_payfast_fix_warning.php
Fix PMPro Payfast showing SSL error in admin menus when set up correctly.
<?php
// Copy from below here...
/*
* Sets the gateway 'ready' global to true
*/
function my_pmpro_payfast_fix_warning( $pmpro_is_ready ) {
return true;
@JarrydLong
JarrydLong / pmpro-tax-filter-states-province.php
Last active January 4, 2022 13:55 — forked from andrewlimaza/pmpro-tax-filter-states-province.php
Custom Tax Structure For Paid Memberships Pro for States/Provinces.
<?php
/**
* This recipe will add tax based on the different Canadian regions.
*
* 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/
*/
function my_pmpro_custom_canada_tax( $tax, $values, $order ) {
@JarrydLong
JarrydLong / pmpro-billing-fields-to-profile.php
Last active November 9, 2022 10:37 — forked from pbrocks/pmpro-billing-fields-to-profile.php
Add the billing fields created by Paid Memberships Pro to your user Profile for easy editing and inclusion in the Members List CSV.
<?php
/**
* This recipe will only add the billing fields to the user profile edit page.
*
* 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 / hide_discount_code_field_for_specific_levels.php
Created July 21, 2021 06:55 — forked from strangerstudios/hide_discount_code_field_for_specific_levels.php
Hide discount code field on the PMPro checkout page for specified levels.
<?php
function hide_discount_code_field_for_specific_levels($show)
{
global $pmpro_level;
if( in_array( intval( $pmpro_level->id ), array(1,2) ) )
{
$show = false;
}
@JarrydLong
JarrydLong / pmpro-invite-only-example.php
Last active July 19, 2021 06:57 — forked from greathmaster/pmpro-invite-only-example.php
PMPro Invite Only Example Setup
<?php //do not copy
//declare as globals
global $pmproio_invite_required_levels;
global $pmproio_invite_given_levels;
$pmproio_invite_required_levels = array(4); //Which levels require an invite code (these levels cannot be signed up for without an invite code)
$pmproio_invite_given_levels = array(5); //Which levels generate an invite code but do NOT require an invite code to be used when purchasing.
define('PMPROIO_CODES', 10 ); //How many invite codes are generated when a $pmproio_invite_given_levels level is purchased?
@JarrydLong
JarrydLong / pmpro-last-five-members.php
Last active June 9, 2021 06:36 — forked from andrewlimaza/pmpro-last-five-members.php
Shortcode to show a list of last five members registered - Paid Memberships Pro
<?php
/**
* Show a list of users that recently signed up. Currently only shows user names and the last 5 registrations.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Use [pmpro_latest_members] shortcode to display a list of users.
*/
function pmpro_show_latest_members_name_shortcode( $atts ) {
global $wpdb, $pmpro_pages;
@JarrydLong
JarrydLong / pmpro-redirect-non-members.php
Last active May 10, 2021 09:34 — forked from strangerstudios/pmpro-redirect-non-members.php
Paid Memberships Pro Redirect Non-members to Login/Homepage
<?php //Do not copy
/*
Redirect to login or homepage if user is logged out or not a member
Add this code to your active theme's functions.php file.
*/
function my_template_redirect()
{
global $current_user;
if( !function_exists( 'pmpro_login_url' ) ){
@JarrydLong
JarrydLong / pmpro-customizations.php
Last active May 4, 2021 09:10 — forked from strangerstudios/pmpro-customizations.php
Tax solution for British Columbia, Canada to be used with Paid Memberships Pro
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@JarrydLong
JarrydLong / my-pmpro-directory-widget-any-page.php
Last active April 12, 2021 13:49 — forked from dparker1005/My_PMPro_Directory_Widget.php
Add widget to Member Directory page to filter results.
<?php
/**
* Plugin Name: My PMPro Directory Widget
* Description: Add widget to Member Directory page to filter results.
*/
class My_PMPro_Directory_Widget extends WP_Widget {
/**
* Sets up the widget
*/
@JarrydLong
JarrydLong / pmpro_checkout_level_custom_prorating_rules.php
Created April 9, 2021 07:06 — forked from ideadude/pmpro_checkout_level_custom_prorating_rules.php
Override the default proration behavior in the PMPro Proration Add On
/*
1. Make sure PMPro and PMPro Proration are both active.
2. Edit the pmpro_checkout_level_custom_prorating_rules function below to your needs.
3. Then add this code into a custom plugin for your site.
*/
/**
* Swap in our custom prorating function.
*/
function init_custom_prorating_rules() {