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
| /** | |
| * We need to set $_REQUEST['level'] early on our | |
| * sitewide sales pages to support other customizations. | |
| * We can't use is_page because WP isn't fully setup yet. | |
| * Update the $sitewide_sales_pages and $default_level_id as needed. | |
| * Add to a custom plugin. | |
| */ | |
| function set_request_level_on_sitewide_sales_pages() { | |
| $sitewide_sales_pages = array( | |
| 'blackfriday', |
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
| /** | |
| * Add a BTC currency to Paid Memberships Pro | |
| * Add this code into a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function pmpro_btc_currency_format( $pmpro_currencies ) { | |
| $pmpro_currencies['BTC'] = array( | |
| 'name' => __( 'Bitcoin', 'paid-memberships-pro' ), | |
| 'decimals' => '8', | |
| 'thousands_separator' => '', | |
| 'decimal_separator' => '.', |
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 | |
| /** | |
| * Change the default text for the one-membership-product-per-cart warning in PMPro WooCommerce. | |
| * Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_gettext_pmprowc_changes( $translated_text, $text, $domain ) { | |
| if( $domain == "pmpro-woocommerce" && $text == "You may only add one membership to your %scart%s." ) { | |
| $translated_text = "Include the %stwo percent-s strings%s, which will add the start and end a tags."; | |
| } | |
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 | |
| /** | |
| * When users expire (and the system changes them to membership level 0) we give them another downgraded level. | |
| * This gist is setup to specifically downgrade level 6 to level 3 with an expiration set to 305 days out and | |
| * downgrade level 5 to level 2 with an expiration set to 150 days out. | |
| * Note that this code is using the pmpro_membership_post_membership_expiry hook which only fires when a user is expired | |
| * by the PMPro cron job. If an admin changes the user's level or they cancel, they will not receive the downgraded level. | |
| * Adjust the gist to meet your needs. | |
| * Add this code to a custom plugin. 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 | |
| /* | |
| [my_pmpro_addon] shortcode. | |
| */ | |
| function my_pmpro_addon_shortcode() { | |
| //load template | |
| $content = pmpro_loadTemplate( 'my_pmpro_addon' ); //will look for /wp-content/themes/your-theme/paid-memberships-pro/pages/my_pmpro_addon.php | |
| //maybe tweak the content a bit |
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 | |
| /* | |
| Tell PMPro to look in the pages directory of this plugin for PMPro page templates. | |
| Add this code to a custom plugin. | |
| Make sure that there is a /pages/ directory in the plugin directory with your templates in it. | |
| */ | |
| function my_pmpro_pages_custom_template_path( $default_templates, $page_name, $type, $where, $ext ) { | |
| $default_templates[] = dirname(__FILE__) . '/pages/' . $page_name . '.' . $ext; | |
| return $default_templates; |
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
| /** | |
| * Checking for membership when accessing non-WP pages. | |
| * This code will work with the htaccess rewrite rules shared here: | |
| * https://www.paidmembershipspro.com/locking-non-wordpress-files-folders-paid-memberships-pro/ | |
| */ | |
| function my_pmpro_getfile_before_readfile( $filename, $file_mimetype ) { | |
| if(is_dir($filename)) { | |
| $filename .= "index.html"; | |
| $mimetype = new pmpro_mimetype(); | |
| $file_mimetype = $mimetype->getType($filename); |
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 handles loading a file from the /protected-directory/ directory. | |
| (!) Be sure to change line 19 below to point to your protected directory if something other than /protected/ | |
| (!) Be sure to change line 66 below to the level ID or array of level IDs to check for the levels you need. | |
| (!) Add this code to your active theme's functions.php or a custom plugin. | |
| (!) You should have a corresponding bit of code in your Apache .htaccess file to redirect files to this script. e.g. | |
| ### |
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
| # Stripe Webhook IPs via https://stripe.com/docs/ips#webhook-notifications | |
| # v create a user/pass in this folder using htpasswd v | |
| AuthUserFile /var/www/vhosts/domain.com/conf/.htpasswd | |
| # ^^ | |
| AuthType Basic | |
| AuthName "Authentication Required" | |
| Require valid-user | |
| Order allow,deny | |
| Allow from 3.18.12.63 | |
| Allow from 3.130.192.231 |
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 | |
| /** | |
| * Functions affecting admins and the admin dashboard. | |
| */ | |
| /** | |
| * Return array of fields found in the wp_users table. | |
| * This function used in the others below to determine if a key entered in a search like "email:[email protected]" | |
| * is referencing the user_email column of the wp_users table or a unique meta key. | |
| */ | |
| function my_pmpro_get_user_table_columns() { |