Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Hiding activity when not logged in.

@antipole

Participant

I have a solution to this – I have written a minimal plugin that diverts to a ‘denied’ page if a non-logged-in user tries to access the private type of information. I still allow the profile to be displayed as that has its own permissions arrangements. Here is my plugin:

<?php
/*
Plugin Name: Make certain pages private
Description: Specifically for ******** website: prevents not-logged-on users from seeing certain pages otherwise visible
Version:     1.0
Author:      Tony *****
*/

function check_for_private_pages()
{
	if (is_user_logged_in() == true){
	/* nothing to do if logged in */
	return;
	}
	else {
	if (bp_is_activity_component() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_groups_component()){
	header('Location: http://'. $_SERVER["HTTP_HOST"] . '/oops-cant-get-you-where-you-tried-to-go/');
	}
	}	
}

add_action('template_redirect', 'check_for_private_pages');

?>
Skip to toolbar