I’m building a city portal/ social business directory with buddypress and wordpress. All business listings are stored as a custom post type called ‘business’. I’m using the following code to show the activity related to business listings in the activity stream
function bbg_record_my_custom_post_type_comments( $post_types ) {
$post_types[] = 'business';
return $post_types;
}
add_filter( 'bp_blogs_record_comment_post_types', 'bbg_record_my_custom_post_type_comments' );
this is the result http://i.stack.imgur.com/Poaay.png
Right now it says
user commented on the post ‘postname’
While I need it to say
user wrote a review on ‘postname’
for the business post type, and
user commented on ‘postname’
for other post types.
Any help is greatly appreciated.
You can filter on the action before it is saved by using add_filter on
‘bp_blogs_activity_new_comment_action’ as shown in
bp-blogs-functions.php -> bp_blogs_record_comment()
Or you can filter before the action is displayed by using add_filter on
‘bp_get_activity_action’
Probably better to do the former because you can easily check post->post_type to see if it is ‘business’.
This shows how to adjust the activity action for the creation of a CPT:
http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/display-custom-post-types-in-activity-feed/
You should be able to adjust that to handle comments.
Thank you @shanebp for the answer. I’m posting my complete function as the answer so it can help others too(wasn’t sure if I was to add it to the question itself)