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 | |
/** | |
* Make the "More Information" container for custom fields 2 columns at Paid Memberships Pro checkout. | |
* Tweak the code below to work for your needs and any other field group you may have. | |
* Follow this guide to add custom code to your WordPress site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_custom_add_jquery_script() { | |
?> | |
<script type="text/javascript"> |
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 'is_renewal' to the data load sent to Zapier when using the New Order trigger for PMPro Zapier Add On. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_add_custom_field_added_order( $data, $order, $user_id ) { | |
if ( $order->is_renewal() ) { | |
$data['is_renewal'] = true; | |
} else { | |
$data['is_renewal'] = false; |
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 | |
/** | |
* Remove Paid Memberships Pro select2 from the GamiPress Leaderboard settings pages. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_custom_dequeue_select2() { | |
if ( isset( $_REQUEST['post_type'] ) && 'gp_leaderboard' == $_REQUEST['post_type'] ) { | |
wp_dequeue_script( 'select2' ); | |
wp_deregister_script( 'select2' ); | |
} |
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 | |
/** | |
* Tweak the user capability required to view the When Last Login - User Statistics charts/reporting. | |
* This requires V1.1+ of When Last Login - User Statistics. | |
* Add this code to your site by following this guide - https://yoohooplugins.com/customize-wordpress/ | |
*/ | |
function my_wll_user_stats_admin_cap( $capability ) { | |
return 'edit_users'; // Change this to the custom capability value. | |
} | |
add_filter( 'wll_stats_access_cap', 'my_wll_user_stats_admin_cap', 10, 1 ); |
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 | |
/** | |
* Remove select2.js and select2.css on non-pmpro pages to prevent conflicts within the WordPress admin. | |
* Only use this if you are 100% certain that the conflict is due to select2 being loaded more than once. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_custom_dequeue_select2() { | |
// Bail if we're on PMPro pages, but remove select2 from all other admin pages. | |
if ( ! empty( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], 'pmpro' ) !== false ) { |
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 | |
/** | |
* Inside the WordPress dashboard, as an administrator add the query ?check_order_success=1 to bulk update all pending check orders. | |
* Use this code with caution as it will update all instances. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_pbc_order_success_sql() { | |
global $wpdb; | |
if ( ! current_user_can( 'manage_options' ) ) { |
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 | |
/** | |
* Supports Paid Memberships Pro V3.0.3+ and automatically sets the orders status to success when payment is done via check. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_pbc_order_success( $order ) { | |
// Do not run this code within the admin area, admins might be creating orders. | |
if ( is_admin() || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'pmpro-orders' ) ) { | |
return; |
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 | |
/** | |
* Run this code _once_ and then remove it from your site. To run this code visit any page of the admin area. | |
* After visiting any admin page, you may delete this script from your site. | |
* This will add legacy logic to the content message for non-members. | |
*/ | |
function my_pmpro_legacy_content_message() { | |
// Only logged-in admins can run this. | |
if ( ! current_user_can( 'manage_options' ) || ! empty( get_option( 'pmpro_nonmembertext' ) ) ) { | |
return; |
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 | |
/** | |
* Bypasses all content restriction for posts, pages, blocks and shortcodes that are on certain pages. | |
* Tweak this code further for your needs. | |
* To add this code to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_allowed_posts() { | |
$open_post_ids = array( 118 ); // Add all the POST ID's that you want to bypass here. | |
return $open_post_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 | |
/** | |
* Add recurring text after Variable Pricing text. | |
* Tweak the wording for your needs. | |
* | |
* To add this code to your site please visit - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_vp_text_adjustment( $text ) { | |
$level = pmpro_getLevelAtCheckout(); | |