Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created January 10, 2018 10:15
Show Gist options
  • Save andrewlimaza/4d58aafbbfe201287dbc85fdfa87b951 to your computer and use it in GitHub Desktop.
Save andrewlimaza/4d58aafbbfe201287dbc85fdfa87b951 to your computer and use it in GitHub Desktop.
Close comments for non-members Paid Memberships Pro
<?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