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 | |
/** | |
* Re-runs the 3.0 upgrade script. | |
*/ | |
function pmpro_upgrade_3_0_rerun() { | |
global $wpdb; | |
// Create a subscription for each unique `subscription_transaction_id` in the orders table. | |
$sqlQuery = " | |
INSERT IGNORE INTO {$wpdb->pmpro_subscriptions} ( user_id, membership_level_id, gateway, gateway_environment, subscription_transaction_id, status ) |
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 | |
function memberlite_modify_columns_ratio_for_blog( $r, $location ) { | |
// Check if the current page is a blog page | |
$maybe_add_sidebar = memberlite_is_blog(); | |
if ( $maybe_add_sidebar && ! in_array( $location, array( 'header-right', 'header-left' ) ) ) { | |
// Set layout ratio for the blog main area and sidebar | |
$r = ( $location == 'sidebar' ) ? '4' : '8'; | |
} |
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 | |
function my_custom_memberlite_woocommerce_hooks() { | |
// Remove Memberlite hooks | |
remove_action( 'woocommerce_before_main_content', 'memberlite_woocommerce_before_main_content', 10 ); | |
remove_action( 'woocommerce_after_main_content', 'memberlite_woocommerce_after_main_content', 10 ); | |
// Add custom WooCommerce hooks | |
add_action( 'woocommerce_before_main_content', 'my_custom_memberlite_woocommerce_before_main_content', 10 ); | |
add_action( 'woocommerce_after_main_content', 'my_custom_memberlite_woocommerce_after_main_content', 10 ); |
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 search the PMPro Member Directory for matching usernames or display names. | |
* | |
* 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_member_directory_sql_search_where_username_display_name_only( $sql_search_where, $s ) { |
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 | |
/** | |
* Sitewide Sales compatibility with RightPress Product Prices - Live Update. | |
*/ | |
function my_sws_apply_sitewide_sales_discount_to_live_price($price, $product) { | |
// Return early if Sitewide Sales is not active. | |
if ( ! defined ( 'SWSALES_VERSION' ) ) { | |
return $price; | |
} |
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 | |
/** | |
* Script to locate, tag, export, then delete inactive users in your Paid Memberships Pro / WordPress website. | |
* | |
* Once this snippet is in the site, admins can run the process by visiting /?delete_inactive_users=1 in the WordPress admin. | |
* Always back up user data before running any bulk delete script and remove this code after the process is done. | |
*/ | |
function my_pmpro_tag_inactive_users() { | |
if ( ! defined( 'PMPRO_VERSION' ) ) { | |
exit; |
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 | |
/** | |
* Filter to only allow access to a protected post by post ID after a specific calendar date. | |
*/ | |
function my_pmpro_has_membership_access_on_date( $hasaccess, $post, $user ) { | |
// If they already don't have access, return. | |
if ( ! $hasaccess ) { | |
return $hasaccess; | |
} |
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 | |
/** | |
* Template Name: My Custom Template | |
* | |
* An example template that uses the pmpro_has_membership_access function to protect content. | |
* | |
*/ | |
get_header(); ?> |
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 credit card logos before the submit button on the Paid Memberships Pro Membership Checkout page. | |
* | |
* Download the icons from https://www.paidmembershipspro.com/add-credit-card-and-paypal-logos-to-checkout/ | |
* Place the image file in the correct location according to your customizations structure. | |
*/ | |
function pmpro_add_my_logos_to_checkout(){ | |
global $pmpro_level; |