Skip to:
Content
Pages
Categories
Search
Top
Bottom

Filtering activity stream on protected forums


  • hypnoscient
    Participant

    @hypnoscient

    Hi,

    I’m using Buddypress with BBPress & ActiveMember360. AM360 protects the forum, that works great.

    However, I want to filter in the activity stream for users that do not have the rights to access the forum and that does not work.

    Here is a global view of my system :

    It’s a membership website where you can’t access anything if you are not a member. Login is mandatory.

    I have 2 kind of membership :

    1. One for the whole site and community access
    2. One that does not allow access to the whole community protected parts but grants access to a specific course.

    The course is associated to a group and a group forum.

    The standard membership forums are not part of a group.

    Members of 1 can see the sitewide activity but not the course group & forums activity : that works well.

    However, member of 2 can see sitewide activity even if I set the forums to private or hidden, which seems logical since they are not part of a group and such Buddypress doesnt know it shouldn’t show them (If I got the documentation / posts here right).

    I would like however to find a way to filter the activity stream.

    I’m trying to play with bp_parse_args but for it to work I have to check for each bbp_create_topic (or reply) activity if the user has access to it, and if not, to not display it.

    I’m getting crasy with that and I wondered if any of you could point me to the right direction.

    I’ve tried to assign the n°1 membership to a Buddypress group and assign it a forum. I made that forum a parent one, and all others below, set to hidden or private. But it does not work.

    Any hints, help, directions ?

    Is what I want to do even possible ?

    Thanks a lot for your time,

Viewing 1 replies (of 1 total)

  • hypnoscient
    Participant

    @hypnoscient

    This seems to work, wondering if there is a better way, to not display it at all instead of using a CSS display:none.

    Comments welcome :

    function action_bp_before_activity_entry(  ) { 
        global $activities_template;
        
    $postid = url_to_postid( $activities_template->activity->primary_link ); 
        echo do_shortcode('
            [mbr_is_allowed_access post_id='.$postid.']
            [ELSE_is_allowed_access]
                <div style="display:none">
            [/mbr_is_allowed_access]
            ');
    }; 
    add_action( 'bp_before_activity_entry', 'action_bp_before_activity_entry', 10, 0 ); 
    
    function action_bp_after_activity_entry(  ) { 
        global $activities_template;
        
        $postid = url_to_postid( $activities_template->activity->primary_link ); 
        echo do_shortcode('
            [mbr_is_allowed_access post_id='.$postid.']
            </div>
            [ELSE_is_allowed_access]
                </div>
            [/mbr_is_allowed_access]
            ');
    }; 
    add_action( 'bp_after_activity_entry', 'action_bp_before_activity_entry', 10, 0 ); 
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar