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
/** | |
* | |
* @param int $save_id | |
* Updates equivalent membership category in other languages when saving levels. | |
* Not suitable for large number of languages. | |
*/ | |
function update_level_categories_for_all_languages($save_id) | |
{ | |
$level_cat_ids = pmpro_getMembershipCategories($save_id); | |
$updated_level_cat_ids = $level_cat_ids; |
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_action( 'init', 'register_daily_email_inactive_members_email'); | |
// Function which will register the event | |
function register_daily_email_inactive_members_email() | |
{ | |
// Make sure this event hasn't been scheduled | |
if( !wp_next_scheduled( 'email_inactive_members' ) ) { | |
// Schedule the event | |
wp_schedule_event( time(), 'daily', 'email_inactive_members' ); | |
} |
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
/* | |
* Send members password through email after checkout. | |
* Use PMPro Email Templates shortcode !!password!! in checkout emails. | |
* Remove password fields using custom checkout template to auto generate password. | |
*/ | |
function my_generate_passwords() | |
{ | |
if(!empty($_REQUEST['username']) && empty($_REQUEST['password'])) | |
{ | |
$_REQUEST['password'] = pmpro_getDiscountCode() . pmpro_getDiscountCode(); //using two random discount codes |
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
/* | |
Only show levels on level page which the original content belonged to. For example if a site has 3 levels: Bronze, Silver, Gold and | |
a post is restricted to Silver and Gold, clicking on the "Register" button will lead them to the levels page showing only Silver and Gold levels. | |
To use: employ the shortcode [my_level_link] under Memberships >> Advanced >> Message for Logged-out Users (or Message for Logged-in Non-members) | |
Ex: | |
This content is for !!levels!! members only.<br /><a href="http://example.com/wp-login.php">Log In</a> <a href="[my_level_link]">Register</a> | |
*/ |
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
function my_pmpro_email_data($data, $email) | |
{ | |
if(ICL_LANGUAGE_CODE == "fr") | |
$data['wpml_pmpro_custom_email_template'] = "This is French"; | |
elseif(ICL_LANGUAGE_CODE == "en") | |
$data['wpml_pmpro_custom_email_template'] = "This is English"; | |
return $data; | |
} |
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
/* | |
* When users cancel, assign them a level based on their status. See list of available status': | |
* http://www.paidmembershipspro.com/2015/03/statuses-available-in-the-pmpro_memberships_users-table-updated-member-history-add-on/ | |
*/ | |
function my_pmpro_after_change_membership_level($level_id, $user_id) | |
{ | |
global $wpdb; | |
if($level_id == 0) | |
{ |
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
/* | |
* Pre select the PayPal Express payment option (vs credit card) when using PayPal Website Payments Pro | |
*/ | |
function pre_select_paypal() | |
{?> | |
<script> | |
jQuery(document).ready(function(){jQuery("input[name=gateway][value='paypalexpress']").click();}); | |
</script><?php | |
} |
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
//From: http://www.paidmembershipspro.com/forums/topic/paypal-express-change-the-cancel-and-return-url/ | |
//Created by user @ultione | |
add_filter( "pmpro_set_express_checkout_nvpstr", "custom_set_paypal_express_cancel_url", 10, 2 ); | |
function custom_set_paypal_express_cancel_url ( $nvpStr, $order ) { | |
parse_str( $nvpStr, $payment_arr ); | |
$level_id = pmpro_getLevel( 'membership_level_name' ); | |
if ( ! empty( $level_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
function my_pmpro_post_membership_levels_header($defaults) | |
{ | |
$defaults['membership_levels'] = 'Membership Levels'; | |
return $defaults; | |
} | |
function my_pmpro_post_membership_levels($column_name, $post_ID) | |
{ | |
if ($column_name == 'membership_levels') | |
{ |
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
function my_pmpro_show_next_payment_date() | |
{ | |
$next_date = pmpro_next_payment(NULL, "success", "date_format"); | |
if($next_date) | |
echo $next_date; | |
else | |
echo "---"; | |
} |
OlderNewer