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
/* | |
Hide billing address fields and make them optional. | |
Meant to be used with the Braintree Payments gateway. | |
*/ | |
//css to hide the fields | |
function wp_head_hide_billing_fields() | |
{ | |
global $post, $pmpro_pages; | |
if(empty($pmpro_pages) || (!is_page($pmpro_pages['checkout']) && !is_page($pmpro_pages['billing']))) | |
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
/* | |
Change expiration text on levels page. | |
*/ | |
function pmprosed_my_pmpro_level_expiration_text($expiration_text, $level) | |
{ | |
$set_expiration_date = pmpro_getSetExpirationDate($level->id); | |
if (!empty($set_expiration_date)) { | |
$set_expiration_date = pmprosed_fixDate($set_expiration_date); | |
$expiration_text = "This membership level will expire on " . date(get_option('date_format'), strtotime($set_expiration_date, current_time('timestamp'))) . "."; | |
} |
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 | |
/** | |
* This example is to show you the 'niche' options each Paid Memberships Pro - Register Helper Add-on field can take and how to use it. | |
* For more information on the Register Helper Add-on please visit https://www.paidmembershipspro.com/add-ons/free-add-ons/pmpro-register-helper-add-checkout-and-profile-fields/ | |
**/ | |
function my_pmprorh_init() | |
{ | |
//don't break if Register Helper is not 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 | |
/* This code recipe will remove the billing address fields from certain membership levels. | |
* This code gist requires the Paid Memberships Pro - Capture Name & Address for Free Levels or for Off-site Gateways Add On to be installed and activated - https://www.paidmembershipspro.com/add-ons/capture-name-address-free-levels-offsite-gateway/ | |
* Change the value "2" in the code recipe with the Paid Memberships Pro Membership Level ID of your choice. | |
* Add this code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function remove_pmpro_billing_fields_by_level_id() { | |
// Specify the Membership Level ID | |
$remove_level = isset( $_REQUEST['level'] ) ? $_REQUEST['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
/* | |
* Add 15 day grace period when membership expires | |
*/ | |
function my_pmpro_membership_post_membership_expiry( $user_id, $level_id ) { | |
// Make sure we aren't already in a grace period for this level | |
$grace_level = get_user_meta( $user_id, 'grace_level', true ); | |
if ( empty( $grace_level ) || $grace_level !== $level_id ) { | |
// Give them their level back with 15 day expiration | |
$grace_level = array(1,2); | |
$grace_level['user_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
<?php | |
/* Generate checkout email when using Add Member from Admin Add On for Paid Memberships Pro | |
*/ | |
function pmpro_send_member_notification( $user_id ) { | |
$pmproemail = new PMProEmail(); | |
$pmproemail->sendCheckoutEmail( get_userdata( $user_id ) ); | |
} | |
add_action( 'pmpro_add_member_added', 'pmpro_send_member_notification', 10, 2 ); |
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 lines 4-15 to your custom plugin or functions.php of your active theme | |
function pmpro_remove_bfields( $pmpro_required_billing_fields ){ | |
//remove field ID's from array to make fields required | |
$remove_field = array('bphone'); | |
//loop through the $remove_field array and unset each billing field to make it optional. | |
foreach($remove_field as $field){ |
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 | |
function my_pmpro_confirmation_url($rurl, $user_id, $pmpro_level) | |
{ | |
if(pmpro_hasMembershipLevel(1)) | |
$rurl = "http://example.com/page_1"; | |
elseif(pmpro_hasMembershipLevel(2)) | |
$rurl = "http://example.com/page_2"; | |
elseif(pmpro_hasMembershipLevel(3)) | |
$rurl = "http://example.com/page_3"; |
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 | |
function my_pmpro_mailchimp_listsubscribe_fields($fields, $user) | |
{ | |
$level = pmpro_getMembershipLevelForUser($user->ID); | |
$enddate = date('Y-m-d', $level->enddate); | |
$new_fields = array("ENDDATE" => $enddate); |
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 | |
//This code will be a full working example that will add 1 checkbox field to your checkout page for all levels. Please copy the code that you need. | |
function my_pmprorh_init() | |
{ | |
//don't break if Register Helper is not loaded | |
if(!function_exists("pmprorh_add_registration_field")) | |
{ | |
return false; |
OlderNewer