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 recipe creates a custom fields for membership registration | |
* that is readonly on the user edit profile for members and | |
* editable by administrators or users with the membership manager role. | |
* | |
* This recipe assumes that the registration field is required during checkout. | |
* | |
* @requires Register Helper Add On | |
* @link https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/ |
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
SELECT distinct mu.user_id, u.user_email FROM wp_pmpro_memberships_users AS mu | |
LEFT JOIN wp_users AS u | |
ON mu.user_id = u.id | |
WHERE mu.startdate < "2020-06-01 23:59:59" | |
AND ( mu.enddate > "2020-06-01 00:00:00" OR mu.enddate = "0000-00-00 00:00:00" OR mu.enddate is NULL ) | |
ORDER BY mu.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 | |
// Copy from below here... | |
/* | |
* Creates a new merge field in Mailchimp if one doesn't already exist. | |
*/ | |
function my_pmpro_mailchimp_merge_fields( $merge_fields ) { | |
// Adds a "COMPANY" merge field to Mailchimp. | |
$merge_fields[] = array('name' => 'COMPANY', 'type' => 'text'); |
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 requires billing fields to be enabled at checkout. | |
* Generate a username from firstname and lastname fields. If name exists will try to generate a random number after the username. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_generate_username_at_checkout() { | |
//check for level as well to make sure we're on checkout page |
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 | |
/* | |
* Allow members to upload their avatar using a Register Helper field during checkout or on the Member Profile Edit page. | |
* | |
* Requires: Paid Memberships Pro, Register Helper Add On. | |
* | |
* 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/ |
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 recipe will convert any Advanced Custom Fields into Register Helper Fields, | |
* ensuring they display on your checkout or signup form. | |
* | |
* 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/ | |
*/ |
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 recipe is based off of the below guide but generaes a member number based on the member's level | |
* https://www.paidmembershipspro.com/generate-a-unique-member-number-for-display-on-membership-account-confirmation-email-and-more/ | |
* | |
* 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/ | |
*/ |
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 membership product name for a WooCommerce product if assigned to a level. | |
* Add this code to your site by following this example: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_show_level_name_woo_product() { | |
global $product; |
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 logged-in non-members from the account page to the levels page. | |
* Requires Paid Memberships Pro 2.3+ | |
* To add this code to your site visit: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function redirect_logged_in_non_members_to_levels_page() { | |
// Check if PMPro is installed. |
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 //do not copy | |
/** | |
* This recipe removes the parameters for the page that gets created for each order. | |
* This ensures that only the user's page is created and no other pages for each level are created. | |
* | |
* 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/ |