Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 12:29 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@JarrydLong
JarrydLong / remove-sub-delay-add-on.php
Last active April 19, 2021 14:25 — forked from andrewlimaza/remove-sub-delay-add-on.php
Remove subscription delay for any previous member for PMPro.
<?php
/**
* Once a user checks out for a level, it will add usermeta to the user's account.
* This will then remove any subscription delay for that member in the future, even if the user cancels and then re-signs up.
*/
// Update level meta everytime a user changes their level to ensure they are blocked from subscription delays.
function my_pmpro_trial_used( $level_id, $user_id ) {
update_user_meta( $user_id, "pmpro_trial_level_used", "1" );
}
@JarrydLong
JarrydLong / pmprorh-rh-phone-field.php
Last active March 22, 2021 10:35 — forked from kimcoleman/redwolfcy_pmprorh_init.php
Register Helper "Phone" Field
<?php
/**
* Register Helper "Phone" Field
*
*/
function pmprorh_init_phone_field() {
//don't break if Register Helper is not loaded
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
@JarrydLong
JarrydLong / mypmpro-add-custom-field-to-email-template.php
Last active March 16, 2021 09:48 — forked from andrewlimaza/add-tax-pmpro-emails.php
Add !!tax!! variable for Paid Memberships Pro email templates
<?php
/**
* Adds an email variable !!tax!! to Paid Memberships Pro emails.
* Use the Email Templates Admin Editor to add !!tax!! to your email templates.
* Follow this guide to add this code to your site: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
* Difficulty: Easy
*/
function my_pmpro_email_variable( $data, $email ) {
@JarrydLong
JarrydLong / mailchimp_oldmember.php
Last active February 27, 2023 22:10 — forked from dparker1005/mailchimp_oldmember.php
Creates an OLDMEMBER merge field in MailChimp.
<?php
/*
* Creates an OLDMEMBER merge field in MailChimp.
*/
function my_pmpro_mailchimp_merge_field_oldmember( $merge_fields ) {
$merge_fields[] = array(
'name' => 'OLDMEMBER',
'type' => 'text'
);
return $merge_fields;
<?php
/*
Plugin Name: PMPro Member Count Shortcode
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Show the number of members in a level w/a status
Version: .2
Author: Thomas Sjolshagen @ Stranger Studios <[email protected]>, strangerstudios
Author URI: http://www.strangerstudios.com
*/
function pmpro_member_count_shortcode( $attrs = null )
@JarrydLong
JarrydLong / my_pmpro_change_level_edd_update_payment_status.php
Last active January 18, 2023 13:37 — forked from andrewlimaza/change-level-edd.php
Change user's Membership Level when a product is purchased in Easy Digital Downloads
<?php
/**
* This recipe will allow you to assign a membership level to members when purchasing an EDD product.
* You can do this one of two ways:
*
* OPTION 1: Product ID and Membership Level
* $product_levels = array(
27 => 1, //27 is the EDD product ID. 1 is the membership level they get when purchasing product 27
);
*
@JarrydLong
JarrydLong / my_pmpro_registration_checks.php
Last active December 28, 2020 12:51 — forked from strangerstudios/my_pmpro_registration_checks.php
Require a certain level before registering for another level with Paid Memberships Pro.
<?php
/*
Require a certain level before registering for another level.
Add this code to your active theme's functions.php or
a custom plugin.
*/
function my_pmpro_registration_checks($okay){
//only check if things are okay so far
if($okay)
{
@JarrydLong
JarrydLong / pmpro-limited-time-registration.php
Last active March 11, 2022 18:11 — forked from LMNTL/pmpro-limited-time-registration.php
Restrict a membership level to no longer allow sign ups after a given date (limited time offer) using Paid Memberships pro
<?php
/* Checks to see if a registration is happening after a given date; if so, prevent registration and stop new signups for the level/no longer display the level on the levels page
*/
global $pmproml_start_date, $pmproml_end_date, $pmproml_limited_level_id;
$pmproml_limited_level_id = array( 1, 2, 4 ); // change to the ID of the limited-time membership level
$pmproml_start_date = "2019/04/01"; // change to the date registration starts, in YYYY/MM/DD format
$pmproml_end_date = "2019/04/30"; // change to the date registration ends, in YYYY/MM/DD format
@JarrydLong
JarrydLong / pmpro-customizations.php
Last active October 21, 2020 07:24 — forked from gausam/pmpro-customizations.php
Allow users to use the trial level only once.
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for my Paid Memberships Pro Setup
Version: .1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com
*/
@JarrydLong
JarrydLong / pmpro-restrict-countries.php
Last active May 29, 2020 16:21 — forked from strangerstudios/pmpro-restrict-countries.php
Only allow for the countries in the $restricted_countries array
/**
* Only sell to specific countries by adding in the 'allowed' countries' in
* the $restricted_countries array.
*
* 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_init()