Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BuddyPress - Merge both blog posts and BP Groupblog posts together when using the "Recent Networkwide Posts" widget.
/**
* Merges both blog posts and groupblog posts together when using the "Recent
* Networkwide Posts" widget supplied by BuddyPress.
*/
function ray_merge_blog_posts_and_groupblog_posts( $retval ) {
// check the Recent Networkwide Posts activity args
// make sure they all match
if ( 'new_blog_post' === $retval['action'] &&
0 == $retval['user_id'] &&
false == $retval['scope'] &&
false == $retval['object'] &&
false == $retval['primary_id']
) {
// override the action to search for blog and groupblog posts
$retval['action'] = 'new_blog_post,new_groupblog_post';
}
return $retval;
}
add_filter( 'bp_after_has_activities_parse_args', 'ray_merge_blog_posts_and_groupblog_posts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment