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
/** | |
* Update member and order searches to also search by discount code. | |
* | |
* I'm not recommending anyone actually use this, but sharing as an example. | |
* | |
* This is a little hacky how the members list SQL is edited. | |
* You get odd results if you change the level or other parameters | |
* on the members list table and also search for an order. | |
* Can also act wonky if you have overlaps between your discount code names | |
* and cities, user names, names, or anything else that would normally |
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
/** | |
* Turn Discount Code dropdown on orders list to a select2 field. | |
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_add_select2_to_discount_code_filter_on_orders_page() { | |
if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'pmpro-orders' ) { | |
wp_enqueue_style( 'select2', plugins_url( 'css/select2.css', __FILE__ ), '', '4.0.6', 'screen' ); | |
wp_enqueue_script( 'select2', plugins_url( 'js/select2.js', __FILE__ ), array( 'jquery' ), '4.0.6' ); | |
function my_add_select2_inline_script() { |
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
[membership level="0"] | |
<!--this is shown to non-members and non-logged in visitors--> | |
[pmpro_advanced_levels levels="1,2,3" layout="3col"] | |
[/membership] | |
[membership level="1,2"] | |
[pmpro_advanced_levels levels="2,3" layout="2col"] | |
<!--this is shown to Level 1 and 2 Members--> | |
[/membership] | |
[membership level="3"] | |
[pmpro_advanced_levels levels="4"] |
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
[membership level="0"] | |
<!--this is shown to non-members and non-logged in visitors--> | |
<div class="pmpro_message pmpro_alert"> | |
Already a member? Log In to unlock additional membership options. | |
</div> | |
[/membership] |
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 XOF currency to Paid Memberships Pro | |
* Add this code into a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_xof_currency_format( $pmpro_currencies ) { | |
$pmpro_currencies['XOF'] = array( | |
'name' => __( 'West African Franc', 'paid-memberships-pro' ), | |
'decimals' => '2', | |
'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 | |
/** | |
* Add the PMPro meta box to a CPT | |
*/ | |
function my_add_pmpro_meta_box_to_cpts() { | |
// Duplicate this row for each CPT. This one adds the meta boxes to 'product' CPTs. | |
add_meta_box('pmpro_page_meta', 'Require Membership', 'pmpro_page_meta', 'product', 'side' ); | |
} | |
add_action( 'admin_menu', 'my_add_pmpro_meta_box_to_cpts', 20 ); |
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
/** | |
* Set CVV as a Required Field with PMPro | |
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* NOTE: Doesn't yet work with all gateways. | |
* You'll need to make sure the gateway is set to require CVV/CVC | |
* and then add an elseif ( ... ) below to set the $CVV var | |
* if you see a valid gateway token/etc. | |
*/ | |
function my_require_cvv_for_reals( $fields ) { |
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
[row] | |
[col medium="6"] | |
[pmpro_account section="profile"] | |
[/col] | |
[col medium="6"] | |
[pmpro_account section="membership"] | |
[/col] | |
[/row] | |
[row] |
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 | |
/* | |
Only allow users to use the trial level once. | |
Add this code to your active theme's functions.php | |
or a custom plugin. | |
Be sure to change the $trial_level_id variable in multiple places. | |
*/ | |
//get trial level ids | |
function my_pmpro_trial_level_ids() { | |
// edit this to be a comma separated list of your trial 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
/** | |
* Disable the custom PHPMailer Code for PMPro. | |
* This will sometimes fix issues with broken/scrambled emails. | |
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Notice we run on the wp_mail_content_type hook on priority 15 to make sure | |
* we run after PMPro sets up the hook here: https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/email.php#L127-L137 | |
*/ | |
function my_disable_pmpro_send_html() { | |
remove_action('phpmailer_init', 'pmpro_send_html'); | |
} |