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 | |
| /** | |
| * Show member number in Members List and Members List CSV export. | |
| * Useful for offering multiple pricing structures for membership (i.e. Monthly, Annually). | |
| * Requires the PMPro Member Unique Number Code Recipe - https://www.paidmembershipspro.com/generate-a-unique-member-number-for-display-on-membership-account-confirmation-email-and-more/ | |
| * Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_members_list_csv_extra_columns($columns) |
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 a member number on the membership card for Paid Memberships Pro. Please read all comments below! | |
| * This requires the following - https://www.paidmembershipspro.com/generate-a-unique-member-number-for-display-on-membership-account-confirmation-email-and-more/ | |
| * At the time of this writing, created a custom page template and added in hook "do_action( 'pmpro_membership_card_additional_fields', $pmpro_membership_card_user );" to the relevant area. | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| * Reach out to the PMPro Support team for help with this code recipe - https://www.paidmembershipspro.com/support/ | |
| */ | |
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 codes requires you to have the PMPro Sponsored/Group Members Add On - https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/ | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| * This code recipe is an example that allows membership level 2 to purchase 5 group membership accounts for membership level 3. | |
| * However, level 3 members will need to individualy pay an initial payment of $20 for their membership accounts. | |
| */ | |
| global $pmprosm_sponsored_account_levels; |
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 | |
| /** | |
| * Requires Paid Memberships Pro and the PMPro Register Helper Add On(https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/) to be installed and activated in order to work | |
| * Please only add this script if you have previously added a custom field to your Register Helper and you need to add another field. | |
| */ | |
| $fields[] = new PMProRH_Field( | |
| 'field_name', // input name, will also be used as meta key | |
| 'text', // type of field |
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 | |
| /* | |
| * Example of Register Helper fields. Code is incomplete. For complete coding solution, please see: https://www.paidmembershipspro.com/documentation/register-helper-documentation/code-examples/ | |
| * | |
| */ | |
| // Define the fields. | |
| $fields = array(); | |
| $fields[] = new PMProRH_Field( | |
| 'company', // input name, will also be used as meta key |
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 | |
| /** | |
| * Automatically approve any previously approved member. | |
| * Requires the PMPro Approval Process for Membership Add On - https://www.paidmembershipspro.com/add-ons/approval-process-membership/ | |
| * Add this code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_automatically_approve_previously_approved( $level_id, $user_id, $cancelled_level ) { | |
| if ( ! class_exists( 'PMPro_Approvals' ) ) { |
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 recipe requires the PMPro Limit Post Views Add On: https://www.paidmembershipspro.com/add-ons/pmpro-limit-post-views/ | |
| * | |
| * This recipe will track post views for members that have bought a membership. | |
| * Members' views will then be tracked, and if views have exceeded based on their respective | |
| * membership level, they'll be redirected away from the post. | |
| * | |
| * 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 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 | |
| /** | |
| * Bulk assign membership levels to posts and pages. | |
| * You will need to adjust the $levels to your desired levels as well as select your desired $post_type. | |
| * Onced added to your site add the following to the end of yout URL in order ro run the script `/wp-admin/?assign_levels_posts=true` | |
| * Add this code to your Customizations Plugin/Code Snippets by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function mypmpro_bulk_assign_levels_to_posts(){ | |
| if( isset( $_REQUEST['assign_levels_posts'] ) ){ |
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 | |
| /** | |
| * Define the default level to use for the modal | |
| */ | |
| define('PMPRO_MODAL_CHECKOUT_DEFAULT_LEVEL', 1); | |
| /** | |
| * Load the checkout preheader on every page | |
| * We won't be processing on every page, but we | |
| * want the code that sets up the level and |
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 ) { |