Hi Brajesh, I’m working on my first BuddyPress plugin. This one is to add post updates to the activity feed.
I have one problem I can’t seem to fix, in that I’m getting the post update in the activity feed, however whilst it’s showing the username it’s not showing the users profile picture.
Here’s my code:
function bpu_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($post->post_author); $bp_activity_id = bp_activity_add(array( 'action' => $user_fullname.' updated ' . $title . ':', 'content' => $post->post_excerpt, 'component' => 'blogs', 'type' => 'activity_update', 'primary_link' => "<strong>" + get_permalink($post_id) + "</strong>", 'user_id' => $user_id, 'item_id' => $post->ID )); } add_action('edit_post', 'bpu_buddypress_edit_post');
As you can see I’m getting the user id from the post author, this seems to work in that it’s showing the correct displayname, but not the users profile image.
Any ideas why this is not working?
Hi George,
Please try changing'user_id' => $user_id,
to
'user_id' => $post->post_author,
and see if that makes any change.
Hi Brajesh, sorry to bother you but I have another related question.
With the above code the post title is not a clickable link and neither is the post authors name. but for a new pst entry in Activity these are clickable. How would I achieve the same? I’ve tried no end of <a href combinations but while they do not cause an error neither do they deliver the required result.
Thanks
Hi George,
Sorry I could not assist earlier.
Glad that you found a solution.Best Regards
Brajesh
You must be logged in to reply to this topic.