hi Mark, this has changed in bp 1.2
try this one
bp_activity_latest_update($user_id);
Change the user Id with the user’s id whose last update you want.
btw, this should also work
$update=get_usermeta( $user_id, 'bp_latest_update' );
echo $update;
Hope it helps.
Thank you Brajesh.
bp_activity_latest_update($user_id); works but directly echos in quotes and with a “View” link added.
Your second suggestion returns “Array”. This should point to a way to simply get the string. Do you know which index would return the status? Some kind of echo $update[‘status’] ?
hi Mark
You are most welcome. I am sorry I missed that and thought the second line will just work.
hmm, you can use this one though with the get_usermeta thing
$update=get_usermeta( $user_id, 'bp_latest_update' );
echo $update['content'];
Works! Thank you very much for your proper assistance Brajesh!
(I’m wondering why we can’t get this out of a BP_Core_User instance?)
Hi,
I hate to hijack this thread, but I am trying to include user’s status from their respective post, from main page posts, and I am unable to do so. I only get a blank response. I can include code if needed.
Hi andrewsa,
you have to give a valid $user_id at least. I’m using this in my blog’s sidebar, have a look at http://spaces.nordblog.net/mark/ in the upper right corner.
I defined in blog theme’s functions.php:
function bp_author_info( $title, $user_id){
// Fetch some ...
// Get author's data BuddyPress style:
$author = new BP_Core_User( $user_id);
// Make output ...
echo "<!-- Status Updates -->
<h2>{$title}</h2>
<ul><li>
<span class=\"alignleft\">
<a href=\"{$author->user_url}\" title=\"Profil von {$author->fullname}\">{$author->avatar_thumb}</a>
</span>\n";
bp_activity_latest_update( $user_id); // contains echo with View link
echo "<span style=\"display: block; clear: both;\"><!-- clear --></span>
</li></ul>\\n";
}
… and inserted in sidebar.php:
if( function_exists( 'bp_author_info')){
bp_author_info( $title = "Mensch", $userid = 2 );
}