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 | |
/** | |
* Check how many posts a member has submitted to a specific form on page ID '48'. | |
* Hide the form if they have reached the submission limit for their Membership Level. | |
*/ | |
function my_pmpro_submission_limit_hide_ws_form( $content ) { | |
// Return early if PMPro is not active or the user is not logged in. | |
if ( ! function_exists( 'pmpro_has_membership_access' ) || ! is_user_logged_in() ) { | |
return $content; | |
} |
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 | |
/** | |
* Wrap the oembed video in a div so we can use custom CSS to make the video responsive inside the container. | |
* You must also add the following custom CSS to your site: | |
* .video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } | |
* .video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } | |
*/ | |
function format_video_profile_field( $value, $original_value, $field_name ) { | |
// Return early if the field name is not 'video' | |
if ( 'video' !== $field_name ) { |
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_kit_add_last_name_to_subscribe_fields( $subscribe_fields, $user_email ) { | |
// Get the user by email | |
$user = get_user_by( 'email', $user_email ); | |
// If the user is found, add the last name to the fields | |
if ( $user ) { | |
$last_name = $user->last_name; | |
if ( $last_name ) { | |
$subscribe_fields['last_name'] = $last_name; |
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 custom card classes to the Terms of Service (TOS) field in PMPro checkout. | |
* | |
* This function uses the 'pmpro_element_class' filter to add custom classes | |
* to the TOS fieldset, form fields, and other elements within the TOS area. | |
* | |
* @param array $class Array of element class names. | |
* @param string $element The element to return class names for. | |
* |
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 away from checkout if the secret URL parameter is missing. | |
*/ | |
function my_pmpro_template_url_parameter_at_checkout() { | |
global $pmpro_pages; | |
// Return early if we are not on a PMPro page. | |
if ( empty( $pmpro_pages ) ) { | |
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 | |
/** | |
* Remove the restricted messages shown on the /forums/ archive in BuddyBoss. | |
* BuddyBoss is running the /forums/ page content through the the_content filter, which detects protected forums within the loop. | |
*/ | |
function my_pmpro_remove_no_access_message_from_bbp_is_forum_archive( $text ) { | |
// Check if we are on the homepage. | |
if ( function_exists( 'bbp_is_forum_archive' ) && bbp_is_forum_archive() ) { | |
// Return an empty string. | |
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 | |
/** | |
* UNTESTED: Check if a user is already at level 1. If they have been at that level for 30 days, upgrade them to level 2. | |
* | |
* 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 my_pmpro_check_and_upgrade_level_on_login( $user_login, $user ) { |
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 | |
/** | |
* Upcoming filter in PMPro v 3.1.2 or higher (not currently released) to adjust the appearance of Stripe Card Element styles. | |
* Refer to this Stripe documentation for available properties: https://docs.stripe.com/js/appendix/style | |
*/ | |
function my_custom_pmpro_stripe_card_element_style($styles) { | |
$custom_styles = array( | |
'base' => array( | |
'color' => '#FFFFFF', | |
'::placeholder' => 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 | |
/** | |
* Show the First and Last Name fields in a single column | |
* | |
* 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/ | |
* | |
*/ |