This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Set a maximum number of members allowed to register for a membership level. | |
Add this code to a plugin for PMPro Customizations. | |
Set the "Maximum" for a level on the Memberships > Membership Levels > Edit Level admin page. | |
*/ | |
function pmproml_pmpro_save_membership_level( $level_id) { | |
if( $level_id <= 0 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Show Members Reports on the WordPress Admin Dashboard. | |
Update the my_pmpro_dashboard_report() function to remove or add core or custom reports. | |
*/ | |
//Create a Dashboard Reports widget for Paid Memberships Pro | |
function add_my_report_dashboard() { | |
if( ! defined( 'PMPRO_DIR' ) || ! current_user_can( 'manage_options' ) ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For a level to expire on a certain date. | |
(Note, this will need to be tweaked to work with PayPal Standard.) | |
*/ | |
function my_pmpro_checkout_level_specific_expiration($level) | |
{ | |
//ignore renewals (they will be pushed out one payment period) | |
if(pmpro_hasMembershipLevel($level->id)) | |
return $level; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function allows a custom confirmation message to be added to a checkout e-mail template. This will allow you to add | |
* your custom confirmation message to an e-mail template, without creating your own custom template in your theme. | |
* | |
* We're checking for the "checkout_" prefix on the e-mail template name and if we have current user data. | |
* We're then getting the custom confirmation level based on the current user data. | |
* We replace the 'is now active.</p>' portion of the body to append the confirmation message. | |
*/ | |
add_filter( 'pmpro_email_body', 'my_pmpro_email_body', 10, 2 ); | |
function my_pmpro_email_body( $body, $email ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_init() | |
{ | |
global $restricted_countries; | |
//specify the countries not allowed to signup. The key is the level id. | |
$restricted_countries = array( | |
1 => array('FR', 'IT'), | |
2 => array('IT'), | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Paid Memberships Pro - Protect Child Pages Add On | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Apply protection to all child pages of a Add-on Page that's protected. | |
Version: .1 | |
Author: Thomas Sjolshagen @ Stranger Studios <thomas@eighty20results.com> | |
Author URI: https://eighty20results.com/thomas-sjolshagen/ | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Address merge types must be handled in a very specific format | |
function my_pmpro_mailchimp_listsubscribe_fields($fields, $user) | |
{ | |
$user_info = get_userdata($user->ID); | |
$new_fields = array( | |
"FNAME" => $user->first_name, | |
"EMAIL" => $user->email, | |
"LNAME" => $user->last_name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Save the pmpro_show_level_ID field | |
function pmpro_hide_level_from_levels_page_save( $level_id ) { | |
if( $level_id <= 0 ) { | |
return; | |
} | |
$limit = $_REQUEST['pmpro_show_level']; | |
update_option( 'pmpro_show_level_'.$level_id, $limit ); | |
} | |
add_action( 'pmpro_save_membership_level','pmpro_hide_level_from_levels_page_save' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Register Helper Example | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Register Helper Initialization 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Register Helper Example | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Register Helper Initialization 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 |
NewerOlder