Skip to content

Instantly share code, notes, and snippets.

<?php
/*
Plugin Name: Restrict administration access
Plugin URI:
Description: Restrict administration access
Author:
Version: 1.00
Author URI:
*/
<?php
/*
Plugin Name: PMPro Customizations (Register Helper Example)
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for Paid Memberships Pro (Register Helper Example)
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
function assign_pmpro_level_to_role($user_id, $role, $old_roles)
{
//we found a role related to pmpro level
if($role == "pmpro_level_1")
{
pmpro_changeMembershipLevel(1, $user_id);
}
elseif($role == "administrator")
{
pmpro_changeMembershipLevel(2, $user_id); //setup level 2 as an all access role or just give them level 1
/*
Set TOS on checkout page.
Change the if/else statement below and change the post ids that $tospage is set to.
*/
function my_option_pmpro_tospage($tospage)
{
global $pmpro_level;
if($pmpro_level->id == 2)
{
<?php
/*
Hide Levels on Levels Page
Adjust this code to your needs (change $levels_hide) and
add this to your active theme's functions.php or a custom WordPress plugins.
*/
function my_pmpro_levels_array($levels)
{
//here is where you define the levels to hide based on level id
$levels_hide = array(1,3,2,4);
/*
Change currencies depending on Paid Memberships Pro level.
Add this code to your active theme's functions.php or a custom plugin.
This is just an example that will need to be tweaked for your needs.
Other places to look into swapping currencies:
* Levels page.
* Invoices page.
* In emails.
* In membership levels table in admin.
<?php
/*
Reorder Levels on Levels Page
Adjust this code to your needs (change $levels_order) and
add this to your active theme's functions.php or a custom WordPress plugins.
*/
function my_pmpro_levels_array($levels)
{
//here is where you define the order of levels based on level id
$levels_order = array(1,3,2,4);
/*
Don't let exisisting members checkout for free level.
*/
function my_pmpro_registration_checks($okay)
{
//only check if things are okay so far
if($okay)
{
global $pmpro_level;
<?php
//shop page for add ons
function pmpro_addons_shortcode($atts, $content=null, $code="")
{
ob_start();
global $wpdb, $post, $current_user, $pmpro_currency_symbol;
?>
<div id="pmpro_addons">
<?php
$count = 0;