bp_get_activity_latest_update( int $user_id )
Return the activity latest update link.
Description Description
Parameters Parameters
- $user_id
-
(Required) If empty, will fall back on displayed user.
Return Return
(string|bool) $latest_update The activity latest update link. False on failure.
Source Source
File: bp-activity/bp-activity-template.php
function bp_get_activity_latest_update( $user_id = 0 ) {
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;
}
/**
* Filters the latest update excerpt.
*
* @since 1.2.10
* @since 2.6.0 Added the `$user_id` parameter.
*
* @param string $value The excerpt for the latest update.
* @param int $user_id ID of the queried user.
*/
$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], bp_activity_get_excerpt_length() ) ) ), $user_id );
$latest_update = sprintf(
'%s <a href="%s">%s</a>',
$latest_update,
esc_url_raw( bp_activity_get_permalink( $update['id'] ) ),
esc_attr__( 'View', 'buddypress' )
);
/**
* Filters the latest update excerpt with view link appended to the end.
*
* @since 1.2.0
* @since 2.6.0 Added the `$user_id` parameter.
*
* @param string $latest_update The latest update with "view" link appended to it.
* @param int $user_id ID of the queried user.
*/
return apply_filters( 'bp_get_activity_latest_update', $latest_update, $user_id );
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.2.0 | Introduced. |