Try:
<?php
$args = array( 'length' => 100 );
bp_member_latest_update( $args );
?>
Thank you for trying to help. Nope, it does show the update but it’s not shortened at all. Any other ideas?
Thanks,
Michael
It works here.
You need to put it in a template overload of this file:
buddypress\bp-templates\bp-legacy\buddypress\members\members-loop.php
Replace the update code with this:
<span class="update"><?php $args = array( 'length' => 50 ); bp_member_latest_update( $args ); ?></span>
hmm, thanks, I don’t get it either. I am editing the file in my child theme at this location: mysite.com/buddypress/members/members-loop.php It’s definitely editing the website as if I delete this part then the last update from a member does not appear. Your code makes the status update appear but it just don’t limit it. I even tried changing 50 to 10 and still long updates. Thanks for your help. Not sure what to do now.
Hi @mfalk75,
try this snippet – in bp-custom.php or child’s functions.php
function bpfr_truncate_latest_update( $update_content ) {
if( 150 < strlen( $update_content ) ) {
$update_content = str_replace( '[…]', '', $update_content );
return trim( substr( $update_content, 0, 10 ) ). ' […]';
}
else
return $update_content;
}
add_filter( 'bp_get_activity_latest_update_excerpt', 'bpfr_truncate_latest_update' );
Tsted as OK with BP 2.5.2
@danbp do I have to call this a different way in my members-loop.php?
There is no need to modify the member loop. You just have to add the function into one of the file i mentionned.
By doing this with bp-custom.php, you don’t need to alter your curent theme and by the way, it will also work in case you use another theme.