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_redirect_non_members_example() { | |
// Check if a non-member is trying to access any other page besides the above or home page. | |
if ( is_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. | |
exit; | |
} | |
} |
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 Register Helper | |
*/ | |
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 | |
/** | |
* PMPro Customization: Register Helper - Add date of birth date picker to checkout | |
*/ | |
//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 |
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 | |
/** | |
* Adds text after the level cost text. | |
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function add_text_before_submit() { | |
echo 'Add additional text here'; | |
} | |
add_action( 'pmpro_checkout_after_level_cost', 'add_text_before_submit' ); |
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; | |
} | |
$fields = array(); | |
$fields[] = new PMProRH_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 action_pmpro_after_change_membership_level( $level_id, $user_id, $cancel_level ) | |
{ | |
$user = get_userdata($user_id); | |
if($level_id == 1) | |
{ | |
$user->add_role( 'editor' ); | |
} |
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 | |
/** | |
* Remove custom trial for existing members (when existing member changes levels/renews) | |
* Adjust the level ID on line 15 to match your needs. | |
* Add this code to your WordPress site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_level_adjustment( $level ) { | |
// Bail if the user currently doesn't have a membership 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 action_pmpro_after_change_membership_level( $level_id, $user_id ) | |
{ | |
$user = get_userdata($user_id); | |
$role_levels = array(1,2,3); | |
if(in_array($level_id, $role_levels)) | |
{ | |
$user->add_role( 'subscriber' ); |
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 // Do NOT copy this line | |
/* Copy from below this line */ | |
function pmpro_remove_bfields( $pmpro_required_billing_fields ){ | |
//remove field ID's from array to make fields required | |
$remove_field = array('bfirstname', 'blastname'); | |
//loop through the $remove_field array and unset each billing field to make it optional. |
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 | |
// Please add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
function my_pmpro_change_text($translated_text, $original_text, $domain) { | |
switch ( $translated_text ) { | |
case 'First Name' : | |
$translated_text = __( 'Change First Name.', 'paid-memberships-pro' ); | |
break; | |