Created
January 10, 2018 10:15
-
-
Save andrewlimaza/4d58aafbbfe201287dbc85fdfa87b951 to your computer and use it in GitHub Desktop.
Close comments for non-members Paid Memberships Pro
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 | |
/** | |
* Close comments for non-members. Non-members will still be able to read the comments. | |
* Add this function to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_close_comments_non_members() { | |
if( !pmpro_hasMembershipLevel() ) { | |
$r = false; | |
}else{ | |
$r = true; | |
} | |
return $r; | |
} | |
add_filter('comments_open', 'pmpro_close_comments_non_members', 20 ); | |
add_filter('pings_open', 'pmpro_close_comments_non_members', 20 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment