Created
December 24, 2013 16:04
-
-
Save anandkumar/8115124 to your computer and use it in GitHub Desktop.
bbPress limit content visibility for non-logged in user
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
// Display Topic Leads | |
add_filter('bbp_show_lead_topic', 'custom_bbp_show_lead_topic' ); | |
function custom_bbp_show_lead_topic( $show_lead ) { | |
if ( !is_user_logged_in() ){ | |
$show_lead[] = 'true'; | |
return $show_lead; | |
}} | |
// Show Topic Leads to Public or Anonymous visitors | |
add_filter('bbp_has_replies', 'synth_logged_in_topics'); | |
function synth_logged_in_topics($have_posts){ | |
if ( !is_user_logged_in() ){ | |
$have_posts = null; | |
echo '<h4 class="login-first alert">This is a private forum.</h4>'; | |
} | |
return $have_posts; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment