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 | |
/** | |
* Display the last visited non-PMPro page in the confirmation message, OR | |
* redirect the member back to the last visited page. | |
* | |
* Usage Guide: | |
* | |
* 1. Set your preference to either display the link or redirect back to | |
* the referrer page by setting the $toggle_display_redirect variable | |
* to true or 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 | |
/** | |
* Adjust the 'Join Now' link on the login page to a custom URL for Paid Memberships Pro. | |
* Follow this guide to add custom code to your membership site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_custom_join_now_link( $links, $allowed_html ) { | |
$links['register'] = '<a href="https://example.com/join-now/">' . __( 'Join Now', 'paid-memberships-pro' ) . '</a>'; | |
return $links; | |
} | |
add_filter( 'pmpro_login_forms_handler_nav', 'my_pmpro_custom_join_now_link', 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
<?php | |
// Add this code below to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
add_filter( 'gettext', 'change_my_cost_example', 20, 3 ); | |
/** | |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext | |
*/ | |
add_filter( 'gettext', 'change_my_cost_example', 20, 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 | |
/** | |
* This recipe will restrict all pages except Paid Memberships Pro pages, | |
* or the home page of your website, the search results page, the 404 page, or defined post/pages to non-members, | |
* non-approved members, or logged-out users. | |
* | |
* This won't affect administrators. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. |
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 &pmpro_reset_analytics=1 to your WordPress dashboard URL/Paid Memberships Pro reports page. | |
* Add this code to your Code Snippets / Custom Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* You may remove this code from your site when you don't need it any longer. | |
*/ | |
function my_pmpro_reset_visit_data() { | |
// Check if URL parameter pmpro_reset_analytics is set | |
if ( isset( $_REQUEST['pmpro_reset_analytics'] ) ) { |
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 will add billing fields to Add Member from Admin and the user profile edit pages. | |
* | |
* Optional: Set if fields should be required | |
* | |
* Requires Paid Memberships Pro and PMPro Register Helper plugins active. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. |
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 | |
/** | |
* This recipe will help you change text on the checkout paid by level | |
* You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
// paste content from below this line |
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 | |
/** | |
* Custom order codes for Paid Memberships Pro Orders. | |
* | |
* This code will take the date and order ID and create | |
* an order code from that such as "INV060920211", "INV060920212", "INV060920213" | |
* and increment with each order added. | |
* | |
* A fallback is in place that if "INV060920211" already exists for some order, | |
* it will just generate a random code to be safe. |
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 | |
/** | |
* Dynamically display certain levels on the Membership Levels page based on the current user's active level | |
* This example allows you to show/hide specific levels on the Membership Levels page. | |
*/ | |
function dynamic_pmpro_levels_array( $levels ) { | |
// Get all the levels | |
$levels = pmpro_getAllLevels( false, true ); | |
// remove levels 1, 5, 6, and 7 user has level 1. |
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 | |
/** | |
* Set Display Name on Membership Checkout and for BuddyPress Name field. | |
*/ | |
function my_first_last_display_name( $user_id, $morder ) { | |
// Get user's first and last name. | |
$first_name = get_user_meta( $user_id, 'first_name', true ); | |
$last_name = get_user_meta( $user_id, 'last_name', true ); |
NewerOlder