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 using min and max input fields for date fields. | |
function my_pmpro_add_user_fields() { | |
// Don't break if PMPro is out of date or not loaded. | |
if ( ! function_exists( 'pmpro_add_user_field' ) ) { | |
return false; | |
} | |
// Store our field settings in an array. |
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 | |
/** | |
* Shows membership level groups on the frontend profile page of the PMPro Membership Directory Add On. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_show_level_group_on_user_profile( $user ) { | |
$levels = pmpro_getMembershipLevelsForUser( $user->ID ); | |
if ( empty( $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 | |
/** | |
* Give access to admins to Addon Packages when "View As" is enabled. | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmproap_support_admin_view_as( $levels, $user_id, $post_id ){ | |
if ( current_user_can( 'manage_options' ) ) { | |
$view_as = get_user_meta( $user_id, 'pmpro_admin_membership_access', true ); |
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 | |
/** | |
* Filter the subscription delay option for membership level ID 2 to be 1 year later if checking out in October. | |
* Change "option_pmpro_subscription_delay_2" to "option_pmpro_subscription_delay_X" for a specific membership level. | |
* | |
* @see https://developer.wordpress.org/reference/hooks/option_option/ | |
* | |
* Add this custom code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_adjust_sub_delay_date( $value, $option ) { |
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 | |
/** | |
* Enable functionality for the Edit Member Panel when saving user info. | |
* Add this code to your site, follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
**/ | |
function my_custom_ffl_fix_user_display_name() { | |
// Make sure Force First and Last Name is installed. | |
if ( ! function_exists( 'ffl_fix_user_display_name' ) ) { | |
return; |
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 | |
/** | |
* Force the locale to be `-sv.mo/.po` if `sv_SE` is detected as the locale. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* This should resolve issues temporarily if you are using Swedish Locale. | |
**/ | |
function my_pmpro_force_locale_for_swedish( $locale, $plugin ) { | |
if ( $plugin === 'paid-memberships-pro' && $locale === 'sv_SE' ) { | |
$locale = 'sv'; | |
} |
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 field !!denied_reason!! to be used in Approvals Denied Email. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_denied_message( $data, $member ) { | |
$denied_reason = get_user_meta( $member->ID, 'my_field_key', true ); // Change 'my_field_key' to the meta key of your custom field. | |
$data['denied_reason'] = $denied_reason; | |
return $data; | |
} |
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 | |
/** | |
* Adjust the number of records sent within a single Zapier trigger for Paid Memberships Pro. | |
* Default is 1 per run. | |
* To add this code to your WordPress site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_trigger_recent_members_limit( $limit ) { | |
return 20; | |
} | |
add_filter( 'pmpro_trigger_recent_members_limit', 'my_pmpro_trigger_recent_members_limit', 10, 1 ); |
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
/** | |
* Adjust the Set Expiration Date Add On programmatically. | |
* Automatically adjust Y1-12-31 to be Y2-12-31 if the current month is October or later. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_programmatically_change_set_expiration_date( $raw_date ) { | |
// No Set Expiration Date, just bail. | |
if ( empty( $raw_date ) ) { | |
return $raw_date; |
NewerOlder