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 | |
/* | |
* Redirect admins to dashboard, everyone else to home page. | |
*/ | |
function my_pmpro_login_redirect_url($url, $request, $user) { | |
//only do this if we have a user | |
if(is_a($user, 'WP_User')) { | |
if(in_array('administrator', $user->roles)) |
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 Address For Free Levels | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-address-for-free-levels/ | |
Description: Show address fields for free levels also with Paid Memberships Pro | |
Version: .1 | |
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
<?php | |
/* | |
* Limit checkouts for membership level | |
*/ | |
function my_pmpro_registration_checks($continue_registration) { | |
global $wpdb; |
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 | |
/* | |
* Return the # of days until expiration for a given user | |
*/ | |
function getDaysUntilExpiration($user_id = NULL) { | |
global $current_user; | |
if(!$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
<?php | |
/* | |
Plugin Name: PMPro Custom Import | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Custom Import Code for PMPro | |
Version: .1 | |
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
<?php | |
/* | |
* Add PMPro Billing Fields to Profile | |
*/ | |
function my_show_extra_profile_fields($user) | |
{ | |
global $pmpro_states; | |
?> |
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
/* | |
Show payment options (as levels) at checkout. | |
*/ | |
// Define groups of levels. array(1,2) means that levels 1 and 2 are in a group and options will be shown for both levels at checkout for those levels. | |
global $pmpro_level_groups; | |
$pmpro_level_groups = array(array(1,2)); | |
//show options at checkout | |
function pmprogl_pmpro_checkout_boxes() |
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 | |
/* | |
* Generate invite codes for all users with a certain membership level. | |
*/ | |
function my_init() { | |
if ( ! empty( $_REQUEST['create_invites'] ) && current_user_can( 'manage_options' ) ) { | |
global $wpdb; |
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 | |
/* | |
* Copy Membership Requirements from one level to another | |
* | |
* Instructions: | |
* 1. Set $copy_from and $copy_to to the level IDs you want | |
* 2. Visit any page of your site and add "©_membership=1" to the address. | |
* | |
*/ | |
function pmpro_copy_membership_requirements() { |
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) { | |
//are we on the cancel page? |