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 bcc for checkout emails | |
*/ | |
function my_pmpro_email_headers_admin_emails($headers, $email) { | |
//bcc checkout emails | |
if(strpos($email->template, "checkout_") !== false) { | |
//add bcc | |
$headers[] = "Bcc:" . "otheremail@domain.com"; | |
} |
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 on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On) | |
* Adjust the code on the line the line "site_url( ' payment-failed')" to redirect to page of your prefereance. | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_login_redirect_url( $url, $request, $user ) { | |
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 here | |
function my_pmproz_after_checkout_data( $data, $user_id, $level, $order ) { | |
$data['my_usermeta'] = get_user_meta($user_id, 'my_usermeta', true); // add your custom usermeta key in place of my_usermeta | |
return $data; | |
} | |
add_filter( 'pmproz_after_checkout_data', 'my_pmproz_after_checkout_data', 10, 4 ); |
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 | |
/* | |
Sample method to show a level's Member Badge on the three column layout of the | |
Membership Levels page when using the Advanced Levels Page Shortcode Add On. | |
*/ | |
function my_pmproal_before_level_member_badge( $level_id, $layout ) { | |
if( function_exists( 'pmpromb_getBadgeForLevel' ) ) { | |
$image = pmpromb_getBadgeForLevel($level_id); | |
if( ! empty( $image ) && $layout == '3col' ) { | |
echo '<img class="pmpro_member_badge" src="' . esc_url($image) . '" border="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
<?php // DO NOT COPY THIS LINE PLEASE | |
/* | |
Change currencies depending on Paid Memberships Pro level. | |
Add this code to your active theme's functions.php or a custom plugin. | |
This changes currency for a membership level from the default currency on your site to Rand. | |
Other places to look into swapping currencies: | |
* Levels page. | |
* Invoices 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
//Enables comments for User Pages | |
function enable_comments_for_user_pages($postdata, $user, $level) | |
{ | |
$postdata['comment_status'] = 'open'; | |
return $postdata; | |
} | |
add_filter('pmpro_user_page_postdata', 'enable_comments_for_user_pages', 10, 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 // DO NOT COPY THIS LINE | |
/** | |
* Redirect all non-admin user's after they login to your website's home page. | |
* Documentation for login_redirect filter - https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect | |
*/ | |
function pmpro_redirect_after_login( $redirect_to, $request, $user ) { | |
if ( isset( $user->roles ) && is_array( $user->roles ) ) { |
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
/* | |
Perform an action on PMPro recurring orders only. | |
A recurring order here is one that | |
(1) Has an earlier order with the same subscription_transaction_id. | |
(2) Is not created at PMPro checkout. | |
Note that we are checking if function_exists for pmpro_isOrderRecurring incase | |
we add this to PMPro core. Also note that the $test_checkout param there is used | |
here to avoid #2 above. So this parameter will check if the currently running PHP | |
script is being fired at checkout, not necessarily if the order was created at checkout, |
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 | |
/* | |
Replace or translate text strings that's not translatable with gettext. | |
*/ | |
// Check page content and replace text strings | |
function my_change_text_gift_addon( $text ) { | |
global $pmpro_pages; |
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_checkout_level($level) | |
{ | |
$current_day = date('j'); | |
$days_in_month = date('t'); | |
$level->initial_payment = $level->initial_payment*(($days_in_month - $current_day)/$days_in_month); | |
return $level; | |
} |
OlderNewer