This file contains hidden or 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 a Custom Report to the Memberships > Reports Screen in Paid Memberships Pro. | |
* | |
* For each report, add a line like: | |
* global $pmpro_reports; | |
* $pmpro_reports['slug'] = 'Title'; | |
* | |
* For each report, also write two functions: | |
* pmpro_report_{slug}_widget() to show up on the report homepage. |
This file contains hidden or 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 | |
/** | |
* Reveal the level name for a disallowed level in the PMPro content message on restricted content. | |
* | |
*/ | |
function show_disallowed_level_names_content_filter( $r, $post_membership_levels_ids, $post_membership_levels_names ) { | |
return true; | |
} | |
add_filter( 'pmpro_membership_content_filter_disallowed_levels', 'show_disallowed_level_names_content_filter', 10, 3 ); |
This file contains hidden or 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 code stores data when a user checks out for a level. | |
* If that user tries to checkout for the same level, the Subscription Delay is removed. | |
* The user is instead charged for their first subscription payment at checkout. | |
* | |
*/ | |
// Record when users gain the trial level. | |
function one_time_trial_save_trial_level_used( $level_id, $user_id ) { |
This file contains hidden or 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 | |
/** | |
* Simplify paid level checkouts by removing Account Information section and generating username and password. | |
* You must be capturing full Billing Information for this recipe to work. | |
*/ | |
/** | |
* Hide the Account Information Section | |
*/ | |
function simple_checkout_hide_account_information_section( $skip_account_fields, $current_user ) { |
This file contains hidden or 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 | |
/** | |
* Only require Email Address to create user. | |
* This recipe requires Paid Memberships Pro and the Register Helper Add On. | |
* | |
* Note: this recipe depends on a future patch to Paid Memberships Pro core plugin in order to function. | |
*/ | |
/** | |
* Hide the Account Information Section |
This file contains hidden or 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 show '0/X spots available.' on membership level if a limit is set from (https://www.paidmembershipspro.com/limit-number-members-membership-level/) | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* For help, post a support thread on www.paidmembershipspro.com | |
*/ | |
function pmpro_show_spots_available( $expiration_text, $level ) { | |
global $wpdb; |
This file contains hidden or 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 | |
/** | |
* Exclude specific email domains from membership signup. | |
* Make sure to edit the $invalid_domains array defined further below | |
* to include only the domains you'd like to block. | |
* | |
*/ | |
function invalid_email_addresses_pmpro_registration_checks( $value ) { | |
$email = $_REQUEST['bemail']; |
This file contains hidden or 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 | |
/** | |
* Restrict your WordPress site for logged in users only. | |
* | |
*/ | |
function my_require_user_login() { | |
global $current_user; | |
// Allow logged in users. | |
if ( is_user_logged_in() ) { |
This file contains hidden or 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 users without access to a single bbPress forum to the Membership Levels page. | |
* | |
*/ | |
function redirect_bbpress_no_access_levels_page( $redirect_to, $forum_id ) { | |
global $pmpro_pages; | |
$redirect_to = get_permalink( $pmpro_pages['levels'] ); | |