WordPress – Paid memberships pro for clubs or associations

A lot of clubs and associations have membership fees that are due on particular dates yearly, these simple customisations will allow you to not only set the recurring payment date but allow pro rata payments for members joining part way through the year.

Paid memberships pro is a great plugin from http://www.paidmembershipspro.com/ it allows you to create paid membership levels and while its basic form may be a bit limited, and I must stress the word bit, as out the box it’s pretty flexible, it makes extensive use of filters making it very easy for 3rd parties to customise it.

First thing to do is create a folder in your plugins directory called pmprocustom then create a file called pmpro-customisations.php the names of the folder and file aren’t important.

Add the following to the file:


<?php 
/* Plugin Name: PMPro Customizations 
Plugin URI: http://www.lockstockmods.net 
Description: Customizations for Paid Memberships Pro 
Version: 0.1 
Author: Kode 
Author URI: http://fanart.tv */ 

function my_pmpro_profile_start_date($startdate, $order) { 
  $next_year = strtotime(" + 1 Year"); 
  $startdate = date("Y", $next_year) . "-01-01T0:0:0"; 
  return $startdate; 
} 
add_filter("pmpro_profile_start_date", "my_pmpro_profile_start_date", 10, 2); 

function my_pmpro_checkout_level($pmpro_level) { 
  $current = date("n"); 
  $persplit = $pmpro_level->initial_payment/6; 
  switch($current) { 
    case "3": case "4": $pmpro_level->initial_payment = $persplit*5; break; 
    case "5": case "6": $pmpro_level->initial_payment = $persplit*4; break; 
    case "7": case "8": $pmpro_level->initial_payment = $persplit*3; break; 
    case "9": case "10": $pmpro_level->initial_payment = $persplit*2; break; 
    case "11": case "12": $pmpro_level->initial_payment = $persplit; break; 
  } 
  return $pmpro_level; 
} 
add_filter("pmpro_checkout_level", "my_pmpro_checkout_level", 10, 1); 

When a members checkout out a particular membership level it will check the month and set the initial payment amount as a pro rata proportion, in my case I have it set to 2 month increments, therefore if the initial payment was £40 and the recurring amount was also £40

  • Jan/Feb joiners would pay the full amount
  • Mar/Apr joiners first payment would be £33.33, therafter £40
  • May/Jun joiners first payment would be £26.67, therafter £40
  • Jul/Aug joiners first payment would be £20.00, therafter £40
  • Sep/Oct joiners first payment would be £13.33, therafter £40
  • Nov/Dec joiners first payment would be £6.67, therafter £40

If you wanted to change it, it is very easy, say you wanted to do the splits in 4 month increments, you would change the code to


function my_pmpro_checkout_level($pmpro_level) { 
  $current = date("n"); 
  $persplit = $pmpro_level->initial_payment/3; 
  switch($current) { 
    case "5": case "6": case "7": case "8": $pmpro_level->initial_payment = $persplit*2; break; 
    case "9": case "10": case "11": case "12": $pmpro_level->initial_payment = $persplit; break; 
  } 
  return $pmpro_level; 
} 

Another alternative would be on a monthly basis


function my_pmpro_checkout_level($pmpro_level) { 
  $current = date("n"); 
  $persplit = $pmpro_level->initial_payment/12; 
  $pmpro_level->initial_payment = $persplit*(12-$current); 
  return $pmpro_level; 
} 

Hope this helps someone

Related Posts