always try and override the values if a filter is available instead of modifying the bp-core files (next bp update you’ll need to make the changes all over again)
bp_activity_latest_update() triggers the member-header activity – there is a filter bp_get_activity_latest_update
as for the forum # permalink – that is in the /groups/single/forum/topic.php theme file (can override with a child theme)
Great. Thanks for your help. I am not quite sure how to apply a filter. I am using a child theme I have created using a heavily modified default theme CSS and my own custom graphics. Do you mean create new files, such as the above, and place them in my child theme folder, instead of simply modifying the core bp files?
Kind regards,
Shane.
It’s a pain to have to use a filter and override the core function simply to remove a presentational element (the view link).
The API needs to be much more granular here (e.g. get_the_activity_name, get_the_acitivity_description, get_the_activity_permalink), rather than echoing large monolithic strings from a single function.
This would make it much easier to design and develop child themes.
We ended up implementing our own versions of bp_activity_latest_update(). Try adding something like the following to your bp-custom.php. Then remember to change the call in your member-header.php file to call your version of the function.
function ka_activity_latest_update( $user_id = false ) {
echo ka_get_activity_latest_update( $user_id );
}
function ka_get_activity_latest_update( $user_id = false ) {
global $bp;
if ( !$user_id )
$user_id = $bp->displayed_user->id;
if ( !$update = get_usermeta( $user_id, ‘bp_latest_update’ ) )
return false;
$latest_update = trim( strip_tags( bp_create_excerpt( $update, 40 ) ) );
return apply_filters( ‘bp_get_activity_latest_update’, $latest_update );
}
oh, we removed the bp_create_excerpt() call as well, as we want to show the whole update:
Change:
$latest_update = trim( strip_tags( bp_create_excerpt( $update, 40 ) ) );
to
$latest_update = trim( strip_tags( $update ) );
I tried to do this. I created bp-custom.php, and placed it in plugins directory (not in plugins/buddypress). the function gets as far as //return $user_id, and will display it, but doesn’t seem to know what $update is.
<?php
//Remove view button on status update
function tty_activity_latest_update( $user_id = false ) {
echo tty_get_activity_latest_update( $user_id );
}
function tty_get_activity_latest_update( $user_id = false ) {
global $bp;
if ( !$user_id ) {
$user_id = $bp->displayed_user->id;
}
//return $user_id;
if ( !$update = get_usermeta( $user_id, 'bp_latest_update' ) ) {
return false;
}
$latest_update = trim( strip_tags( $update ) );
return apply_filters( 'bp_get_activity_latest_update', $latest_update );
}
?>
Update:
I searched through BP files for ‘bp_activity_latest_update’. When you find it you see it’s echo of the function ‘bp_get_activity_latest_update’. I copied this function into my theme, renamed it, and removed one line.
In theme file, where you want to place status, put the following:
<?php if ( bp_is_active( 'activity' ) ) : ?>
<div class="statusnote" style="border:1px solid;">
<?php //override 'View' button
function tty_get_activity_latest_update( $user_id = false ) {
if ( empty( $user_id ) )
$user_id = bp_displayed_user_id();
if ( bp_is_user_inactive( $user_id ) )
return false;
if ( !$update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) )
return false;
$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) );
return apply_filters( 'tty_get_activity_latest_update', $latest_update );
}
?>
<?php echo tty_get_activity_latest_update(); ?>
</div>
<?php endif; ?>
Then remove the old one from members/single/member-header.php:
<?php if ( bp_is_active( 'activity' ) ) : ?>
<div id="latest-update">
<?php bp_activity_latest_update( bp_displayed_user_id() ); ?>
</div>
<?php endif; ?>