Created
October 29, 2015 12:54
-
-
Save anonymous/58d5b91ad1ba15ae5f32 to your computer and use it in GitHub Desktop.
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
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