function record_post_activity_content_update( $excerpt, $post_content, $activity ) {
global $post;
if( $post->post_type == 'post' ) {
$post_content= '<a href="' . get_permalink( $post->ID ) . '" class="activity-content-title" >'
. get_the_post_thumbnail( $post->ID )
. get_post_field('post_title', $post->ID) . '</a>'
.get_post_field('post_content', $post->ID);
}
return $post_content;
}
add_filter( 'bp_blogs_record_activity_content', 'record_post_activity_content_update');
I put this in bp-custom. Is this correct? I also changed the post_type to mine which is tutorial but it doesn’t seem to be affecting the stream I have on the homepage.
This is what I ended up doing for now if anyone cares 🙂
<?php
if (is_user_logged_in() && is_home()) {
$user_id = get_current_user_id();
$user=wp_get_current_user();
$name=$user->display_name;
$following_ids = bp_get_following_ids( array( 'user_id' => $user_id ) );
$follows = implode( ',', (array) $following_ids );
$args = array (
'max' => 5,
'filter' => array(
'user_id' => $follows,
'action' => 'new_tutorial'
)
);
$pre_rec = bp_activity_get($args);
$activities = $pre_rec['activities']; ?>
<div class="container-fluid follow-updates">
<div class="row">
<div class="col-md-12">
<h2 class="sub-title"><?php echo $name ?> follows...</h2>
<div class="container">
<div class="row activity-row">
<?php if($activities){
foreach ($activities as $activity) {
$postID = strip_tags($activity->secondary_item_id);
$post = get_post($postID);
include(TEMPLATEPATH."/partials/tutorial-block.php");
// 'ID' => strip_tags($activity->id),
// 'TYPE' => strip_tags($activity->type),
// 'TIME' => strip_tags($activity->date_recorded),
// 'AUTHOR' => strip_tags($activity->display_name),
// 'TITLE' => strip_tags($activity->action),
// 'CONTENT' => strip_tags($activity->content),
// 'ITEM_ID' => strip_tags($activity->item_id),
// 'REL_ID' => strip_tags($activity->secondary_item_id),
}
} else { ?>
<p class="text-center"><?php _e('There are no recent posts of those you follow. Find new friends!'); ?></p>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
btw- that’s Buddypress Follows that I get the following IDs from.
well thats not really editing the activity content its a custom foreach loop 😉
@modemlooper I know! I tried the code you gave me but I couldn’t get it working. Time constraints involved.