im looking through the bp-groups-activity.php am i in the right area?
found this section in the bp-groups-activity.php
this seems to relate to the public groups, does anyone have any ideas on what to change here?
// Set the default for hide_sitewide by checking the status of the group
$hide_sitewide = false;
if ( !empty( $args[‘item_id’] ) ) {
if ( bp_get_current_group_id() == $args[‘item_id’] ) {
$group = groups_get_current_group();
} else {
$group = groups_get_group( array( ‘group_id’ => $args[‘item_id’] ) );
}
if ( isset( $group->status ) && ‘public’ != $group->status ) {
$hide_sitewide = true;
}
}
$r = wp_parse_args( $args, array(
‘id’ => false,
‘user_id’ => bp_loggedin_user_id(),
‘action’ => ”,
‘content’ => ”,
‘primary_link’ => ”,
‘component’ => buddypress()->groups->id,
‘type’ => false,
‘item_id’ => false,
‘secondary_item_id’ => false,
‘recorded_time’ => bp_core_current_time(),
‘hide_sitewide’ => $hide_sitewide
) );
return bp_activity_add( $r );
}
i have tried changing the $hide_sitewide = false; to $hide_sitewide = true;
but this doesnt work properly.
> exclude creation of public groups and comments posted in them from displaying in the activity stream.
Changing to $hide_sitewide will prevent it from appearing anywhere ( including the group activity stream ) except the activity stream for the person who created the item.
You probably want items to appear in the group stream, so try this in bp-custom.php or your theme functions.php
function remove_groups_from_activity( $activity ) {
if( $activity->component == 'groups' )
$activity->hide_sitewide = true;
}
add_action( 'bp_activity_before_save', 'remove_groups_from_activity', 1, 1);
Of course, this will only apply to new activity items.
Then you need to ‘reveal’ those hidden items in a group stream…
Create a template overload of this file:
\bp-templates\bp-legacy\buddypress\activity\activity-loop.php
Then before the loop, check if you’re viewing a group and if so, then change the
bp_has_activities call to:
if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&show_hidden=true') ) :
The activity stream is quite flexible:
Activity Loop
Hey @shanebp ty for your response, i have just woke up and read this and will be trying it in the next hour, i will update you on if this solved my problem or not.
Create a template overload of this file:
\bp-templates\bp-legacy\buddypress\activity\activity-loop.php
i assume by this you mean copy this file over to my child twenty twelve theme and make the edits specified in there?
@shanebp ty again shane, i still have not had the chance to try this, but im defo gonna get round to it in the next hour lol, so from reading that article i would make a buddypress folder in my twenty twelve child theme then add an activity folder inside it, then i should copy the activity-loop.php from the directory you specified. and then i would perform the edit you mentioned above? is this correct? just making sure im clear on what to do before doing it.
or should i just copy the entire buddypress directory over from \bp-templates\bp-legacy\buddypress\ to my child theme before making the edit?
i havent needed to do anything as of yet with buddypress template files you see as all other edits i have made have been in the functions.php and bp-custom.php