Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 07:45 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@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 / 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 / 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
);
*
<?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 / 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;
@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 / 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 / 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 / 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() {
@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
*/