bp_get_activity_latest_update( int $user_id )

Return the activity latest update link.

Description

Parameters

$user_id

(Required) If empty, will fall back on displayed user.

Return

(string|bool) $latest_update The activity latest update link. False on failure.

Source

File: bp-activity/bp-activity-template.php

2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
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 BuddyPress 1.2.10
     * @since BuddyPress 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', 'buddyboss' )
    );
 
    /**
     * Filters the latest update excerpt with view link appended to the end.
     *
     * @since BuddyPress 1.2.0
     * @since BuddyPress 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
BuddyPress 1.2.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.