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
/* | |
Modified to transfer over unused days from old level into new level. For example: | |
Level 1 expires in 30 days and Level 2 expires in 180 days. If a members signs up | |
for Level 1 and 5 days in decides to up upgreade to Level 2, thier new expiry date | |
will be (30 - 5) + 180 days. | |
*/ | |
//if checking out for the same level, add remaining days to the enddate | |
function my_pmpro_checkout_level($level) | |
{ | |
global $pmpro_msg, $pmpro_msgt; |
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 | |
/* | |
Only allow users to use the trial level once. | |
Add this code to your active theme's functions.php | |
or a custom plugin. | |
Be sure to change the $trial_level_id variable in multiple places. | |
*/ | |
//record when users gain the trial level | |
function my_pmpro_after_change_membership_level($level_id, $user_id) | |
{ |
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
/* | |
Member Numbers from Defined List | |
* Member numbers are generated when users are registered or when the membership account page is accessed for the first time. | |
*/ | |
//Generate member_number when a user is registered. | |
function generate_member_number($user_id) | |
{ | |
global $member_number_array = array("1111", "2222", "3333"); //add additional codes to this array | |
$member_number = get_user_meta($user_id, "member_number", true); |
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
/* | |
When users cancel (are changed to membership level 0) we give them another "cancelled" level. Can be used to downgrade someone to a free level when they cancel. | |
*/ | |
function my_pmpro_after_change_membership_level($level_id, $user_id) | |
{ | |
if($level_id == 0) | |
{ | |
//cancelling, give them level 1 instead | |
$expiry_level_id = 1; | |
$level = pmpro_getLevel($expiry_level_id); |
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
/* | |
Redirect away from the level page if you don't have membership | |
*/ | |
function my_template_redirect_upgrade() | |
{ | |
global $pmpro_pages, $pmpro_level; | |
if(empty($pmpro_pages)) | |
return; | |
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: PMPro BuddyPress Customizations | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-buddypress-customizations/ | |
Description: Example code to lock down parts of BuddyPress with PMPro | |
Version: 0.2 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
/* |
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
/* | |
Change cancellation to set expiration date for next payment instead of cancelling immediately. | |
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly). | |
Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs. | |
*/ | |
//before cancelling, save the next_payment_timestamp to a global for later use. (Requires PMPro 1.8.5.6 or higher.) | |
function my_pmpro_before_change_membership_level($level_id, $user_id) | |
{ |
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
curl -L http://bit.ly/10hA8iC | bash |
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_pmpro_add_cols_header($order_ids) { | |
ob_start(); ?> | |
<th>Discount Code</th><?php | |
return ob_get_clean(); | |
} | |
add_filter('pmpro_orders_extra_cols_header', 'my_pmpro_add_cols_header'); | |
function my_pmpro_add_cols_body($order) { |
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 | |
/* | |
Filter the BuddyPress Registration page to the Membership Levels page. | |
*/ | |
function my_bp_get_signup_page( $page ) | |
{ | |
//is PMPro activated? | |
if(defined('PMPRO_VERSION')) | |
{ | |
//filter the BuddyPress registration page to PMPro levels page |
OlderNewer