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 filter will search your codebase for translatable strings and replace when an exact match is found. | |
* | |
* Add this code to your PMPro Customizations Plugin | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* @param string $output_text this represents the end result | |
* @param string $input_text what is written in the code that we want to change | |
* @param string $domain text-domain of the plugin/theme that contains the code |
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 filter will send additional user meta fields to contacts in GetResponse. | |
* | |
* Add this code to your PMPro Customizations Plugin | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* @param array $fields the array of fields to send | |
* @param object $user what is written in the code that we want to change | |
*/ |
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 will create a content filter for pages to remove access to posts that were published before a member's join date. | |
* It includes a 15 day "grace period" so that members can see posts published up to 15 days prior to their join date. | |
* | |
* The params passed are: | |
* $hasaccess - (bool) what PMPro thinks about whether the user has access | |
* $thepost - (post object) the post being checked, usually the current post | |
* $theuser - (user object) the user being checked, usually the current user | |
* $post_membership_levels - (array of levels) the levels this post requires (if any) |
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 | |
/* | |
* Bcc additional email addresses on all PMPro emails sent to the member. | |
*/ | |
function bcc_on_member_email_headers( $headers, $email ) { | |
//bcc emails not already going to admin_email | |
if ( $email->email != get_bloginfo( 'admin_email' ) ) { | |
//add bcc | |
$headers[] = "Bcc:" . "[email protected],[email protected]"; | |
} |
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 | |
function my_pmpro_getresponse_custom_fields( $fields, $user ) { | |
// Get fields from Register Helper user meta | |
$phone = get_user_meta($user->ID, 'mytheme_phone', true); | |
$fullname = get_user_meta($user->ID, 'mytheme_fullname', true); | |
$fields = array( | |
'telephone' => $phone, | |
'full_name' => $fullname, | |
); | |
return $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
<?php | |
/* | |
* Execute custom code if the user does not have access to the content. | |
*/ | |
$queried_object = get_queried_object(); | |
if ( | |
function_exists( 'pmpro_has_membership_access' ) && | |
! empty( $queried_object ) && | |
empty( pmpro_has_membership_access( $queried_object->ID, NULL, false ) ) |
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 output of the Series post list to exclude posts the current user cannot access. | |
*/ | |
function hide_noaccess_posts_pmpro_series( $post_list_posts, $series ) { | |
if ( function_exists( 'pmpro_has_membership_access' ) ) { | |
foreach ( $post_list_posts as $key => $sp ) { | |
$hasaccess = pmpro_has_membership_access( $sp->id, NULL, false ); | |
if ( empty( $hasaccess ) ) { |
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 | |
/** | |
* Track membership level as Custom Dimension 1 (dimension1) in your Google Analytics tracking code. | |
* | |
* Requires Paid Memberships Pro and the Google Analytics Dashboard for WP by ExactMetrics (formerly GADWP) plugin. | |
*/ | |
function my_pmpro_membership_level_gadwp_analytics( $gadwp ) { | |
$commands = $gadwp->get(); // Get commands 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 | |
/** | |
* Dynamically display certain levels on the Membership Levels page based on the current user's active level | |
* This example allows you to show/hide specific levels on the Membership Levels page. | |
*/ | |
function dynamic_pmpro_levels_array( $levels ) { | |
// Get all the levels | |
$levels = pmpro_getAllLevels( false, true ); | |
// remove levels 1, 5, 6, and 7 user has level 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
<?php | |
/** | |
* Adds a Register Helper "My Extra Field" input after billing fields. | |
*/ | |
function sample_pmprorh_init() { | |
//don't break if Register Helper is not loaded | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |