Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @nathanallen

    Participant

    That plugin you mentioned appears to prevent saving of certain activity types. Since I still want “user joined the group” messages to appear on non-feed pages, that plugin doesn’t really help.

    In the end I came up with this code, which appears to work well so far:

    `function nla_bp_has_activities( $val )
    {
    if( ! is_feed() )
    return $val;
    global $activities_template;
    $i=0;
    foreach( $activities_template->activities as $item )
    {
    if( $item->type == “joined_group” )
    $joined[] = $i;
    $i++;
    }
    foreach( $joined as $item )
    unset( $activities_template->activities[$item] );
    foreach( $activities_template->activities as $item )
    $activities[] = $item;
    $activities_template->activities = $activities;
    $activities_template->activity_count = count( $activities_template->activities );
    $activities_template->total_activity_count = count( $activities_template->activities );
    $GLOBALS = $activities_template;
    return $val;
    }
    add_action( ‘bp_has_activities’, ‘nla_bp_has_activities’ );`

    @nathanallen

    Participant

    This is what I’ve got so far, but it’s not working…

    `function nla_bp_has_activities($val){
    global $activities_template;$i=0;$a=array();
    //var_dump($activities_template);exit();
    foreach($activities_template->activities as $item){
    if($item->type == “joined_group”)
    $a[]=$i;
    $i++;
    }
    foreach($a as $item)unset($activities_template->activities[$item]);
    array_values($activities_template->activities);
    $activities_template->activity_count=count($activities_template->activities);
    $activities_template->total_activity_count=count($activities_template->activities);
    //var_dump($activities_template);exit();
    return $val;
    }
    add_action( ‘bp_has_activities’,’nla_bp_has_activities’ );`

    @nathanallen

    Participant

    I thought that too, but I didn’t have any success with it. So I did some more digging and found what I was looking for:
    /wp-content/plugins/buddypress/bp-activity/feeds/bp-activity-group-feed.php

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar