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
/* | |
Adds !!todaysdate!! as an available variable for use in Paid Memberships Pro emails. | |
Notice the array key does not include the !!s | |
*/ | |
function my_pmpro_email_data($data, $email) | |
{ | |
$data['todaysdate'] = date(get_option("date_format")); | |
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
/* | |
Disable the "Admin Change" emails in Paid Memberships Pro | |
*/ | |
function my_pmpro_email_recipient($recipient, $email) | |
{ | |
if($email->template == "admin_change" || $email->template == "admin_change_admin") //could check for a different template here | |
$recipient = NULL; | |
return $recipient; | |
} | |
add_filter("pmpro_email_recipient", "my_pmpro_email_recipient", 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
/* | |
If a redirect_to value is passed into /login/ and you are logged in already, just redirect there | |
*/ | |
function tml_redirect_to_logged_in() | |
{ | |
if(is_page("login") && !empty($_REQUEST['redirect_to']) && is_user_logged_in()) | |
{ | |
wp_redirect($_REQUEST['redirect_to']); | |
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
/* | |
Nicer level costs. | |
*/ | |
function nicer_pmpro_level_cost_text($text, $level) | |
{ | |
global $pmpro_currency_symbol; | |
if(pmpro_isLevelFree($level)) | |
$text = "Membership is free."; | |
elseif($level->initial_payment == $level->billing_amount) |
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
//keep non-members from posting comments | |
function my_pmpro_pre_comment_approved($approved) | |
{ | |
if(!pmpro_hasMembershipLevel()) | |
wp_die("Only members can post comments."); | |
return $approved; | |
} | |
add_filter( 'pre_comment_approved', 'my_pmpro_pre_comment_approved' ); |
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 discount code field unless one is present | |
function my_pmpro_show_discount_code($show) | |
{ | |
if(!empty($_REQUEST['discount_code']) || !empty($discount_code)) | |
$show = true; | |
else | |
$show = false; | |
return $show; | |
} |
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 to Show Date instead of Term | |
*/ | |
function my_pmpro_level_expiration_text($text, $level) | |
{ | |
if($level->expiration_number) | |
{ | |
$expiration_text = sprintf(_x("Membership expires on %s.", "Expiration text. E.g. Membership expires on 12/31/2013.", "pmpro"), date(get_option("date_format"), strtotime("+ " . $level->expiration_number . " " . $level->expiration_period))); | |
} | |
else |
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
/* | |
Make shortcodes work in level confirmation text. | |
*/ | |
function pmpro_confirmation_message_shortcodes($message) | |
{ | |
return do_shortcode($message); | |
} | |
add_filter("pmpro_confirmation_message", "pmpro_confirmation_message_shortcodes"); |
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
/* | |
Remove the "This membership is free" text from membership change emails. | |
*/ | |
function nofree_pmpro_email_data($email_data, $email) | |
{ | |
if(!empty($email_data['membership_change'])) | |
$email_data["membership_change"] = str_replace(". This membership is free", "", $email_data["membership_change"]); | |
return $email_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
/* | |
Adjust start date to the first following Sunday | |
*/ | |
//at checkout | |
function my_pmpro_checkout_start_date($startdate) | |
{ | |
//which day is it | |
$checkout_day = date("N"); | |
//days to sunday |