Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding activity when not logged in.


  • Antipole
    Participant

    @antipole

    Hi… I have a BP site which is largely private to logged-in users. But I have discovered non-public information can be viewed via the activity stream, either on the Site wide activity page or members profile activity tab.

    Could SKS tell me how to stop this. It would be sufficient to prevent display of all activity information (including bbPress topics/comments) if the user is not logged in.

    I have researched plugins, but been unable to find anything suitable.

    I have had a few stabs at modifying the Activity Loop but without success.

    Any help/pointers will be much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)

  • djsteveb
    Participant

    @djsteveb

    Someone recently posted some code that gets into this a bit when it comes to member profiles – https://buddypress.org/support/topic/bp-member-pages-visibility-restriction/#post-241840

    not sure if it works, obviously if it does it would need to be adapted for your activity page instead of members..

    There have been a lot of QnA regarding privacy settings with bp pages / partial components the past so many months – maybe that is something that will make it into a future version.

    There could be other answers to this currently. I am not a bp dev, just another user with limited understanding of how it ticks.


    Antipole
    Participant

    @antipole

    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');
    
    ?>
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hiding activity when not logged in.’ is closed to new replies.
Skip to toolbar