This file contains 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
1. cmd+shift+p | |
2. Type phpcs and install it | |
3. Preferences > Package Settings > PHP Code Sniffer > Settings - User |
This file contains 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
/* | |
When users cancel (are changed to membership level 0) we give them another "cancelled" level. | |
Can be used to downgrade someone to a free level when they cancel. | |
Will allow members to the "cancel level" to cancel from that though. | |
*/ | |
function my_pmpro_after_change_membership_level_default_level($level_id, $user_id) | |
{ | |
//Level ID of membership that you will allow level cancellation on. (Assume this is a free level or lower level than level ID 2 - see line 26) | |
$cancel_level_id = 1; |
This file contains 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 | |
/* | |
Plugin Name: PMPro Customizations | |
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Customizations for my Paid Memberships Pro Setup | |
Version: .1 | |
Author: Paid Memberships Pro | |
Author URI: https://www.paidmembershipspro.com | |
*/ | |
This file contains 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 term "membership" to "subscription" for plugin generated text | |
*/ | |
function my_pmpro_gettext_membership($translated_text, $text, $domain) | |
{ | |
if($domain == "paid-memberships-pro") | |
{ | |
$translated_text = str_replace("Membership", "Subscription", $translated_text); | |
$translated_text = str_replace("membership", "subscription", $translated_text); |
This file contains 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
/* | |
Set random order "code" to equal the order ID | |
It is important to keep the prefix (PMPRO-) below or change it to something else with a non-number in it. | |
If a code is all numeric, PMPro will go into an infinite loop when a new order is created. | |
*/ | |
function my_pmpro_random_code($code, $order) | |
{ | |
global $wpdb; |
This file contains 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 this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
function my_init() | |
{ | |
global $allowed_countries; | |
//specify the countries allowed to signup. The key is the level id. | |
$allowed_countries = array( |
This file contains 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 | |
/* | |
Update line 8 with the array of sidebar IDs you want to filter. | |
Add this code to your active theme's functions.php or a custom plugin. | |
*/ | |
function my_pmpro_widget_display_callback($instance, $widget, $args) { | |
$hide_sidebars_array = array('sidebar-1','sidebar-2'); | |
global $post; | |
//check if current user has an active membership level and hide the sidebars. |
This file contains 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
/* | |
Assigns a random 6 digit number for a username automatically. | |
Two variations... | |
the first will show the username field with number already filled, but editing is disabled. | |
The second variations (uncomment the lines) will not show the username field at all, but will simply generate the numerical username and display it on the confirmation page. | |
*/ | |
function my_pmpro_checkout_after_user_fields() | |
{ | |
echo "<script>"; |
This file contains 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 | |
$countries = array | |
( | |
'AF' => 'Afghanistan', | |
'AX' => 'Aland Islands', | |
'AL' => 'Albania', | |
'DZ' => 'Algeria', | |
'AS' => 'American Samoa', | |
'AD' => 'Andorra', |
This file contains 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 MyCRED points to whenever a user checksout for a PMPro Membership Level. | |
* Allows different points per membership level. | |
* Allows different points amount for membership renewals. | |
* Add this code below to your PMPro Customizations Plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* MyCRED can be downloaded/configured here: https://wordpress.org/plugins/mycred/ | |
* Any questions, please feel free to visit www.paidmembershipspro.com | |
*/ |