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 | |
| /* | |
| * Override the Advanced Setting to hide excerpts if this is 'page' post type. | |
| * | |
| * 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
| /* Use this with the recipe here: https://gist.github.com/kimcoleman/faf2cd0a83f3ca7a5c6c368e371ad1f3 */ | |
| .pmpro_protected_post_featured_image { | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .pmpro_protected_post_featured_image img { | |
| filter: grayscale(1) blur(5px); | |
| } | |
| .pmpro_protected_post_blur_mask { | |
| -webkit-box-align: center; |
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 | |
| /** | |
| * Script to locate, tag, export, then delete inactive users in your Paid Memberships Pro / WordPress website. | |
| * | |
| * Once this snippet is in the site, admins can run the process by visiting /?delete_inactive_users=1 in the WordPress admin. | |
| * Always back up user data before running any bulk delete script and remove this code after the process is done. | |
| */ | |
| function my_pmpro_tag_inactive_users() { | |
| if ( ! defined( 'PMPRO_VERSION' ) ) { | |
| exit; |
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 members on login to a specific page based on their 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 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 new "Membership Level" Custom Dimension to your Google Analytics tracking code. | |
| * | |
| * Requires Paid Memberships Pro, MonsterInsights Pro and the MonsterInsights - Dimensions Addon. | |
| */ | |
| /** | |
| * Filter for adding the new dimension as under Insights > Settings > Dimensions | |
| */ |
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 | |
| /** | |
| * Set Display Name on Membership Checkout and for BuddyPress Name field. | |
| */ | |
| function my_first_last_display_name( $user_id, $morder ) { | |
| // Get user's first and last name. | |
| $first_name = get_user_meta( $user_id, 'first_name', true ); | |
| $last_name = get_user_meta( $user_id, 'last_name', 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
| /** | |
| * One-time update: Set user_nicename to a safe "first-name-last-name" format for existing users. | |
| */ | |
| function my_update_existing_user_nicenames() { | |
| // Only run for admins to avoid performance hits or unauthorized access. | |
| if ( ! current_user_can( 'manage_options' ) ) { | |
| return; | |
| } | |
| // Add a transient so we only run this once. |
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 user nicename to use a sanitized first-name-last-name format. | |
| */ | |
| function my_set_safe_user_nicename( $nicename ) { | |
| if ( ! isset( $_POST['first_name'] ) || ! isset( $_POST['last_name'] ) ) { | |
| return $nicename; | |
| } | |
| $first_name = sanitize_text_field( $_POST['first_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 | |
| /** | |
| * Show the pmpro_account shortcode on the WooCommmerce My Account page for members | |
| * who have a history of membership through Paid Memberships Pro. | |
| */ | |
| function pmpro_do_membership_account_shortcode() { | |
| global $wpdb, $current_user; | |
| if( is_user_logged_in() && defined( 'PMPRO_VERSION' ) ) { ?> | |
| <style> .pmpro_actionlinks {display: none; } </style> | |
| <?php |
NewerOlder