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 custom variables to PDF template editor to show some more order information. | |
* To add this code to your site, please visit - https://yoohooplugins.com/customize-wordpress/ | |
*/ | |
function my_pmpro_pdf_card_details( $data_array, $user, $order_data ) { | |
$data_array['{{card}}'] = esc_html( $order_data->accountnumber ); | |
$data_array['{{card_expiration}}'] = esc_html( $order_data->expirationmonth . '/' . $order_data->expirationyear ); | |
$data_array['{{order_status}}'] = esc_html( $order_data->status ); | |
return $data_array; |
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 stops the logic of redirecting members to the main site on the network when viewing a PMPro page on the subsite. | |
* This is useful for cases where you need to still access these membership pages on the subsite. | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
remove_filter( 'pmpro_url', 'pmpro_multisite_pmpro_url', 10, 4 ); | |
remove_action( 'init', 'pmpro_multisite_get_parent_site_pages', 20 ); |
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 Kosovo as a country to the Paid Memberships Pro countries dropdown. | |
* To add this code to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_add_kosovo_country( $countries ) { | |
$countries['XK'] = 'Kosovo'; | |
asort( $countries ); // Sort it alphabetically again. | |
return $countries; | |
} |
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 | |
/** | |
* Change "Month" to "Monthly" etc when using `[pmpro_member field="membership_cycle_period"]` shortcode. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_reword_cycle_period_member_shortcode( $r, $user_id, $field ) { | |
// This isn't the cycle period field, let's bail. | |
if ( $field !== 'cycle_period' ) { | |
return $r; |
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 | |
/** | |
* Show lesson content for a specific course ID using a shortcode. | |
* Use [my_pmpro_show_course_content id="5"] to display the lessons for course ID of 5. | |
* Tweak this output to your needs further, as this is used as a starting template. | |
* | |
* To add this code to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_show_course_content( $atts ) { |
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 | |
/** | |
* Show the next payment date via shortcode [pmpro_next_payment_shortcode] | |
* Add this code to your site by following - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_next_payment_shortcode() { | |
$next_payment = pmpro_next_payment(); | |
if ( $next_payment ) { | |
$output = date_i18n( get_option( 'date_format' ), $next_payment ); |
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 | |
/** | |
* Create a custom order column header and value for the PMPro Orders table. | |
* Add this code to your site by following - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
// Create a custom column in the orders table of PMPro. | |
function my_pmpro_add_column_header_order( $columns ) { | |
$columns['my_custom_column'] = __( 'My Custom Column', 'pmpro' ); | |
return $columns; |
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 the variable {{discount_code}} to the PDF to show what discount code was used for the order. | |
* Follow this guide to add this custom code to your site - https://yoohooplugins.com/customize-wordpress/ | |
*/ | |
function my_pmpro_add_discount_code_to_pdf( $variables, $user, $order_data ) { | |
// Get the discount code used for the order and assign it to {{discount_code}} | |
$order = new MemberOrder( $order_data->code ); | |
$discount_code = $order->getDiscountCode(); |
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 the ability to use shortcodes inside the Non-Member text Paid Memberships Pro displays on restricted content. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_allow_shortcodes_non_member_text() { | |
add_filter( 'pmpro_non_member_text_filter', 'shortcode_unautop' ); | |
add_filter( 'pmpro_non_member_text_filter', 'do_shortcode' ); | |
add_filter( 'pmpro_not_logged_in_text_filter', 'shortcode_unautop' ); | |
add_filter( 'pmpro_not_logged_in_text_filter', 'do_shortcode' ); |
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 | |
/** | |
* Show last login timestamp shortcode. Use [wll_show_login] on any page or post where needed. | |
* Add this code to your site by following this guide - https://yoohooplugins.com/customize-wordpress/ | |
*/ | |
function wll_show_login_shortcode() { | |
// Get the current user's ID | |
$user_id = get_current_user_id(); | |
// Check if the user is logged in |