Adding Multiple Custom Activity Feeds to the Stream
-
Hi, I am working with this code I found to show a CPT of fb_url_submit links. It works great but I would like to add other CPT’s to display in the same way on the Buddypress activity feeds, but with a different link of course.
When I try it says I cannot duplicate one of the CPT activity actions, and I am not a coder, so could someone please help me figure how to add the CPT’s of “news” and “images” while also showing them in the activity stream, and able to change the link that is displayed?
Thank you in advance!
<?php
function inspired_record_more_types( $types ) {
$types[] = 'fb_url_submit';
return $types;
}
add_filter( 'bp_blogs_record_post_post_types', 'inspired_record_more_types');
?><?php
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 == 'fb_url_submit' ) {
if ( is_multisite() )
$activity_action = sprintf( __( '%1$s added a new Facebook Page', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '' . $post->post_title . '', '' . get_blog_option( $blog_id, 'blogname' ) . '' );else
$activity_action = sprintf( __( '%1$s added a new Facebook Page', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '' . $post->post_title . '' );}
return $activity_action;
}
- You must be logged in to reply to this topic.