I would like to filter the sitewide activity loop to only show blog updates. I used display:none with css, but that made it very buggy. Is there a code I can put in my functions.php? I was reading this site, but it seems outdated because the codes give me syntax errors. https://premium.wpmudev.org/blog/how-to-customize-the-buddypress-activity-loop/
<?php if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) . ‘&action=new_blog_post’ ) ) : ?>
^this gave me a syntax error and it is from the codex lol
I discovered the buddypress support lol. I found an answer that works for me. Here it is for others that may need it. Sorry 😛
function bpex_bp_activity_types( $retval ) {
if ( bp_is_active( ‘activity’ ) ) {// list of all BP activity types – remove or comment those you won’t show.
$retval[‘action’] = ‘
activity_comment,
activity_update,
// bbp_topic_create,
// bbp_reply_create,
friendship_created,
created_group,
joined_group,
last_activity,
new_avatar,
new_blog_post,
new_blog_comment,
new_member,
updated_profile
‘;return $retval;
}
}
add_filter( ‘bp_after_has_activities_parse_args’, ‘bpex_bp_activity_types’ );^comment whatever you dont want in the activity stream by putting a // before it. For example I put // before everything except “new_blog_post”
Well this does it on all activity even on your personal profile. Is there a way to just keep this setting on ONLY the activity page?
Hi Chris,
You can use the aconditionif( ! bp_is_activity_directory()) { return $retval; }
at the top of your function.
Hope that helps.
Do I put that above everything? Sorry, I’m a php noob lol.
This is the code I used and it worked. Thanks a lot for the help!!!!
function bpex_bp_activity_types( $retval ) {
if( ! bp_is_activity_directory()) {
return $retval;
}if ( bp_is_active( ‘activity’ ) ) {
// list of all BP activity types – remove or comment those you won’t show.
$retval[‘action’] = ‘
//activity_comment,
//activity_update,
// bbp_topic_create,
// bbp_reply_create,
//friendship_created,
//created_group,
//joined_group,
//last_activity,
//new_avatar,
new_blog_post,
//new_blog_comment,
//new_member,
//updated_profile
‘;return $retval;
}
}
add_filter( ‘bp_after_has_activities_parse_args’, ‘bpex_bp_activity_types’ );You are doing well 🙂
I am glad I could help a little bit.Marking ti as resolved.
Regards
Brajesh
The topic ‘ [Resolved] Filtering the sitewide activity’ is closed to new replies.