Created
June 12, 2014 02:19
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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