Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Highlight specific post categories in the activity stream?


Boone Gorges
Keymaster

@boonebgorges

There are two options. One is to hook a function to bp_blogs_new_blog_post that takes the post content and uses bp_activity_update_meta to add the category to the activity meta table. Then you’d have to build a function that does something like what you want in_category to do, which would work by using bp_activity_get_meta to get the category that you recorded when the blog post was saved.

The other option is to hook a filter to bp_has_activites, which would loop through all of the returned activities, identify the new blog posts by the activity action, and when it found one, load the entire blog post in order to get the categories. In order to load the blog post, you’d probably have to switch_to_blog and then use get_post. This is really database intensive and should probably be avoided – the first option is probably the best (though it won’t be retroactive).

Skip to toolbar