Skip to content

Instantly share code, notes, and snippets.

@r-a-y
Created June 12, 2014 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-a-y/0a00109db5065e00f192 to your computer and use it in GitHub Desktop.
Save r-a-y/0a00109db5065e00f192 to your computer and use it in GitHub Desktop.
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