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_email_headers_approval_emails($headers, $email) | |
{ | |
$args = array('role' => 'pmpro_approver'); | |
$pmpro_approvers = get_users($args); | |
$pmpro_approvers_emails = array(); | |
foreach($pmpro_approvers as $pmpro_approver) | |
{ | |
$pmpro_approvers_emails[] = $pmpro_approver->user_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
<?php | |
function my_pmpro_members_list_csv_heading($csv_header) | |
{ | |
$heading = explode(',', $csv_header); | |
$remove = array('billing firstname', 'billing lastname', 'address1', 'address2', 'city', 'state', 'zipcode', 'country', 'phone'); | |
foreach($heading as $key => $title) | |
{ | |
if(in_array($title, $remove)) |
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_translate_mailchimp($translated_text, $original_text, $domain) { | |
switch ( $translated_text ) { | |
case 'Join our mailing list.' : | |
$translated_text = __( 'Your Changed Text Here', 'pmpro-mailchimp' ); | |
break; | |
} | |
return $translated_text; |
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() | |
{ | |
//don't break if Register Helper is not loaded | |
if(!function_exists( 'pmprorh_add_registration_field' )) { | |
return false; | |
} | |
//define the fields |
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 | |
/** | |
* 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. | |
* Will allow members to the "cancel level" to cancel from that though. | |
*/ | |
function pmpro_after_expiration_change_membership_levels( $level_id, $user_id ) { | |
// set this to the id of the level you want to give members when they cancel | |
$last_level_4 = 4; | |
$level_4_cancel_id = 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 | |
/** | |
* This will redirect members with level 1 from site.com/page-slug to the home page. | |
* Please adjust accordingly and add to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function redirect_member_from_page_x() { | |
if ( is_page( 'shop' ) && ! pmpro_hasMembershipLevel() ) { | |
wp_redirect( home_url('login') ); //redirect to home page. Change home_url() to home_url( '/page-slug' ) to redirect to specific page. |
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() | |
{ | |
//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 | |
/* | |
Each user can only use one discount code. | |
Add this to your active theme's functions.php or a custom plugin. | |
*/ | |
function my_pmpro_check_discount_code($okay, $dbcode, $level_id, $code) | |
{ | |
global $wpdb, $current_user; | |
$codes_used = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->pmpro_discount_codes_uses WHERE user_id = '" . $current_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 | |
/** | |
* Redirect non-members (including logged-in non-members) away from restricted pages and to home page. | |
* This allows non-members to access Paid Memberships Pro checkout/levels pages as well as the default WordPress login page. | |
* | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_redirect_non_members_example() { |
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 require First Name, Last Name and Email address to create user. | |
* This recipe requires Paid Memberships Pro and the Register Helper Add On. | |
*/ | |
/** | |
* Hide the Account Information Section | |
*/ |