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
<?php | |
function my_pmpro_registration_checks_require_code_to_register($pmpro_continue_registration) | |
{ | |
//only bother if things are okay so far | |
if(!$pmpro_continue_registration) | |
return $pmpro_continue_registration; | |
//level = 4 and there is no discount code, then show an error message | |
global $pmpro_level, $discount_code; |
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
/** | |
* Allow customers to access wp-admin | |
*/ | |
add_filter( 'woocommerce_prevent_admin_access', '__return_false' ); | |
add_filter( 'woocommerce_disable_admin_bar', '__return_false' ); |
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
<html> | |
PMPro Free (<a href="http://pmpro.local/wp-admin/admin.php?page=pmpro-approvals&s=user06%40pmpro.local">Pending</a>) | |
</html> | |
<p>Menu</p> | |
<nav> | |
<ul> | |
<p>Menu</p> |
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_disable_member_emails($recipient, $email) | |
{ | |
$user = get_user_by('login', $email->data['user_login']); | |
$level = pmpro_getMembershipLevelForUser($user->ID); | |
$disabled_levels = array(1,2,3); //update this to include ids of all levels you want to disable emails for | |
if(!empty($level) && !empty($level->id) && in_array( intval( $level->id ), $disabled_levels) && $email->template == "membership_recurring") | |
$recipient = NULL; |
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 5 onwards to your custom PMPro plugin -> http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
//we have to put everything in a function called on init, so we are sure Register Helper is loaded | |
function my_pmprorh_init() | |
{ | |
//don't break if Register Helper is not loaded | |
if(!function_exists("pmprorh_add_registration_field")) | |
{ | |
return false; | |
} |
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 the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmprorh_init() { | |
//don't break if Register Helper is not loaded | |
if(!function_exists( 'pmprorh_add_registration_field' )) { | |
return false; | |
} |
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 limit_text_area() | |
{ | |
echo | |
" | |
<script> | |
jQuery(document).ready(function() { | |
jQuery('#company_info').on('keyup', function() { | |
var words = this.value.match(/\S+/g).length; |
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_pmprorh_init_2() | |
{ | |
//don't break if Register Helper is not loaded | |
if(!function_exists("pmprorh_add_registration_field")) | |
{ | |
return false; | |
} | |
global $pmpro_countries; |