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 a custom column to the Memberships > Members admin page for a user field | |
* added via Register Helper using the PMPro hook method. | |
* | |
* 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 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... | |
/* | |
* Changes membership manager so that they can only view | |
* the members list and add new members via PMPro Add Member. | |
* | |
* Can customize using your own caps from here: | |
* https://github.com/strangerstudios/pmpro-membership-manager-role/blob/35725b5cc9d7fd403255e4143a5bd5f1564b022d/pmpro-membership-manager-role.php#L16-L42 | |
*/ |
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 | |
/** | |
* Sync additional user fields to Mailchimp. | |
* You must create the fields in Mailchimp first. | |
* Or, you can use the `pmpro_mailchimp_merge_fields` filter to create them through the API. | |
* | |
* 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 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 allow you to assign a membership level to members when purchasing an EDD product. | |
* You can do this one of two ways: | |
* | |
* OPTION 1: Product ID and Membership Level | |
* $product_levels = array( | |
27 => 1, //27 is the EDD product ID. 1 is the membership level they get when purchasing product 27 | |
); | |
* |
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 a link to Gravatar and an avatar preview on the Profile section of the Membership Account page. | |
* | |
* 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/ | |
*/ | |
function show_gravatar_pmpro_account_bullets_top() { |
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 | |
/** | |
* Redirect non-members to the Membership Levels page if they do not have a membership 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/ | |
* | |
*/ |
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 | |
/** | |
* Extend the membership expiration date for a member with remaining days on their current level | |
* when they complete checkout for ANY other level that has an expiration date. | |
* Always add remaining days to the enddate. | |
* Pulled in from: https://gist.github.com/3678054 | |
*/ | |
function my_pmpro_checkout_level_extend_memberships( $level ) { | |
global $pmpro_msg, $pmpro_msgt, $current_user; |
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 | |
/** | |
* Call to http://yoursite.com/?verify=email@domain.com&secret=SOMESECRETHERE to check the membership level of a user. | |
*/ | |
function my_init_pmpro_mini_api() { | |
if ( function_exists( 'pmpro_getMembershipLevelForUser' ) && | |
! empty( $_REQUEST[ 'verify' ] ) && | |
! empty( $_REQUEST[ 'secret' ] ) ) | |
{ | |
if ( $_REQUEST[ 'secret' ] != 'SOMESECRETHERE' ) { |
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
/** | |
* Retroactively assign a user to a Parent account when using the Sponsored Members Add On. | |
* Enter the user ID of parent account in the "Assign to Parent Account" on the "Edit Profile" screen. | |
* | |
* Note: The user's active Membership Level must be the correct "Child" level for that Parent/Child relationship. | |
* | |
*/ | |
function pmprosm_assign_child_members( $profileuser ) { | |
if ( function_exists( 'pmprosm_getSponsor' ) && current_user_can( 'edit_users' ) ) { |
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 a hidden field in Ninja Forms to capture Membership Level (if user is logged in). | |
* | |
* For Ninja Forms version 3 and higher. | |
*/ | |
// Create Membership Level field for Ninja Forms | |
add_filter( 'ninja_forms_register_fields', function( $fields ) { | |
if ( class_exists( 'PMProMembershipLevelNFInput' ) ) { | |
$fields['pmpromembershiplevel'] = new PMProMembershipLevelNFInput; |