Skip to content

Instantly share code, notes, and snippets.

Created October 29, 2015 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/58d5b91ad1ba15ae5f32 to your computer and use it in GitHub Desktop.
Save anonymous/58d5b91ad1ba15ae5f32 to your computer and use it in GitHub Desktop.
add_filter ( 'bp_blogs_record_post_post_types', 'activity_publish_custom_post_types',1,1 );
function activity_publish_custom_post_types( $post_types ) {
$post_types[] = 'product';
return $post_types;
}
add_filter('bp_blogs_activity_new_post_action', 'record_cpt_activity_action', 1, 3);
function record_cpt_activity_action( $activity_action, $post, $post_permalink ) {
global $bp;
if( $post->post_type == 'product' ) {
if ( is_multisite() )
$activity_action = sprintf( __( '%1$s added or updated the product %2$s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', get_blog_option($blog_id, 'blogname'));
else
$activity_action = sprintf( __( '%1$s created a new Videos post, %2$s', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '' . $post->post_title . '' );
}
return $activity_action;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment