Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to filter "so and so joined the group" from group activity stream?

  • Profile photo of VictorTookes
    VictorTookes
    Participant

    @victortookes

    I’ve read http://codex.buddypress.org/developer/loops-reference/the-activity-stream-loop/
    and I’m sure this is much easier than I’m thinking.

    I’m looking to remove group_joins, because my groups feel like they’re comprised entirely of “So and so has joined the group.”

    The existing filters drop-down doesn’t work with rtMedia media posts don’t show up in any filter option except “everything.

    In my particular install, I don’t see any reason for everyone to see every single group join.

    Thanks in advance for your help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Profile photo of informerfrk
    informerfrk
    Participant

    @informerfrk

    In friends only activity plugin change the following code

    /* if member of a group – we want the activity even if nonfriend */
    if ( $activity->component != 'groups' && $activity->user_id != 0 && !my_is_friend_check($activity->user_id) && !my_is_atme_check($activity->content) ) {
    

    Into

    /* if member of a group – we want the activity even if nonfriend */
    if ( $activity->component != 'no_activity_component_shown' && $activity->user_id != 0 && !my_is_friend_check($activity->user_id) && !my_is_atme_check($activity->content) ) {
    
    Profile photo of VictorTookes
    VictorTookes
    Participant

    @victortookes

    @informerfrk I am running that plugin, and made the change to the code, but it had no effect.

    I even approved some people after updating the new code and they still showed in the group activity feed.

    Profile photo of VictorTookes
    VictorTookes
    Participant

    @victortookes

    Ahh, so it worked to show me only my friends joining. Which is work-able.

    But now I get
    Warning: Division by zero in /home/recivity/public_html/wp-content/plugins/buddypress/bp-activity/bp-activity-template.php on line 783

    Profile photo of bp-help
    bp-help
    Participant

    @bphelp

    Add this if your using that old outdated plugin:

    
    /* Stop errors if any */
    error_reporting(E_ERROR | E_PARSE);
    /* End Stop Errors */
    
    Profile photo of VictorTookes
    VictorTookes
    Participant

    @victortookes

    Generally I’d rather fix the problem than just mute the error. But in this case I gave it a try, re-enabled the code, and suppressed the error.

    But it turns out, the code above is hiding ALL activity from non admin accounts. Not just joins.

    There has to be a “right” way to do this that doesn’t involve an “old outdated plugin”

    Any suggestions, @bphelp?

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Rather than filter it, prevent the entry from being created.

    Try this in your theme/functions.php or plugins/bp-custom.php
    It won’t remove existing entries, but should stop new ones.

    function victor_dont_save_join_group_activity( $activity_object ) {
     
        $exclude = array( 'joined_group' );
     
        if( in_array( $activity_object->type, $exclude ) )
            $activity_object->type = false;
     
    }
    add_action('bp_activity_before_save', 'victor_dont_save_join_group_activity', 1, 1 );
    Profile photo of VictorTookes
    VictorTookes
    Participant

    @victortookes

    @Shanebp you are my hero.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to filter "so and so joined the group" from group activity stream?’ is closed to new replies.