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 default settings for new Content Visibility blocks, such as specific membership levels and the "no access" message. | |
| * | |
| * This registers a default variation of the pmpro/membership block, so newly inserted | |
| * blocks start with these settings. Existing blocks are not changed. | |
| * Requires WordPress 6.5 or newer. Adjust the level IDs below to match your site. | |
| * | |
| * 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. |
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 | |
| /** | |
| * Restrict access to files uploaded through PMPro user fields so that only the | |
| * member who uploaded a file, or an administrator, can view or download it. | |
| * | |
| * This code alone DOES NOT block direct access. It requires the matching web server rule below. | |
| * | |
| * Scope: Single-site WordPress installed at the domain root, with local files and | |
| * the standard /wp-content/uploads/ URL. | |
| * |
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 | |
| /** | |
| * One-time tool to clear card details (type, last 4 digits, expiration) from existing PMPro orders. | |
| * | |
| * Usage: | |
| * 1. Back up your database. | |
| * 2. As an administrator, visit any admin page with ?pmpro_clear_card_details=1 added to the URL, | |
| * for example: /wp-admin/?pmpro_clear_card_details=1 | |
| * 3. Click the confirmation link in the notice that appears. The link carries a nonce, so a | |
| * URL alone (or a link on another site) can't trigger the clear. |
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 | |
| /** | |
| * Clear card details (type, last 4 digits, expiration) from PMPro orders. | |
| * | |
| * Runs after every order insert and update. It writes to the database directly | |
| * with $wpdb so it doesn't call saveOrder() again and loop. | |
| * | |
| * 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. |
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 | |
| /** | |
| * Translate strings in the Streamvid PMPro invoice template (jws-streamvid | |
| * get_invoice_html_pmpro AJAX handler) and nowhere else. | |
| * | |
| * Uncomment a line in $map and change the right-hand side to translate it. | |
| * | |
| * 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. |
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 | |
| /** | |
| * Per-level schedules for the PMPro Extra Expiration Warning Emails Add On. | |
| * | |
| * Edit my_pmproeewe_level_schedules() to set, for each level ID, how many days before | |
| * expiration to send a warning and which email template to use. Levels can share a | |
| * day value with different templates. | |
| * | |
| * How it works: the Add On runs one combined schedule (every day value used by any level). | |
| * For each member it finds, this snippet checks whether the member's level has an email |
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 to their BuddyBoss profile page on login. | |
| * | |
| * Uses BuddyBoss's dynamic /members/me/ link, which resolves to the | |
| * logged-in user's profile. Requires the BuddyBoss Platform (or BuddyPress) | |
| * profiles component to be active. | |
| * See: https://buddyboss.com/docs/dynamic-user-profile-links/ | |
| * | |
| * You can add this recipe to your site by creating a custom plugin |
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 | |
| /** | |
| * Display the "short" level cost text when using the {{ membership_cost }} email variable. | |
| * | |
| * 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_email_data_membership_cost_short( $data, $email ) { |
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 | |
| /** | |
| * Hide the PMPro protected content message card on the blog homepage. | |
| * | |
| * 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_hide_no_access_message_homepage( $html, $level_ids ) { |
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 logged-out visitors away from restricted content to the login page. | |
| * | |
| * When a logged-out visitor hits a post/page that requires membership, | |
| * they are redirected to the login page with a redirect_to parameter | |
| * pointing back to the content. | |
| * | |
| * 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. |
NewerOlder