3
votes

I'm using wordpress multisite along with buddypress installed.

I want to add an activity to the user who updated a post. However, its not working. No activity is added.

Here is my code:

function buddypress_edit_post($post_id) {
     global $bp, $user_id;
     $post = get_post($post_id); 
     $title = $post->post_title;
     $user_fullname  = bp_core_get_user_displayname($user_id);

     bp_activity_add(array(
    'action' => $user_fullname.' updated ' . $title . ':',
    'component' => 'blog_post',
    'type' => 'update_post',
    'primary_link' => get_permalink($post_id),
    'user_id' => $user_id
     ));

}
add_action('edit_post', 'buddypress_edit_post');

What seems to be the problem? Please help.

1

1 Answers

3
votes

Activity type is "update_post" is not available in Buddypress. You have to update activity use default "activity_update".

bp_activity_add(array(
    'action' => $user_fullname.' updated ' . $title . ':',
    'component' => 'blog_post',
    'type' => 'activity_update',
    'primary_link' => get_permalink($post_id),
    'user_id' => $user_id
     ));