bp_activity_format_activity_action_activity_update( string $action, object $activity )

Format ‘activity_update’ activity actions.

Description

Parameters

$action

(Required) Static activity action.

$activity

(Required) Activity data object.

Return

(string) $action

Source

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

1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
function bp_activity_format_activity_action_activity_update( $action, $activity ) {
    if ( bp_activity_do_mentions() && $usernames = bp_activity_find_mentions( $activity->content ) ) {
        $mentioned_users = array_filter( array_map( 'bp_get_user_by_nickname', $usernames ) );
 
        $mentioned_users_link = array_map( function($mentioned_user) {
            return bp_core_get_userlink( $mentioned_user->ID );
        }, $mentioned_users);
 
        $last_user_link = array_pop($mentioned_users_link);
 
        $action = sprintf(
            __( '%s <span class="activity-to">to</span> %s%s%s', 'buddyboss'),
            bp_core_get_userlink( $activity->user_id ),
            $mentioned_users_link? implode(', ', $mentioned_users_link) : '',
            $mentioned_users_link? __(' and ', 'buddyboss') : '',
            $last_user_link
        );
    } else {
        $action = sprintf( __( '%s posted an update', 'buddyboss' ), bp_core_get_userlink( $activity->user_id ) );
    }
 
    /**
     * Filters the formatted activity action update string.
     *
     * @since BuddyPress 1.2.0
     *
     * @param string               $action   Activity action string value.
     * @param BP_Activity_Activity $activity Activity item object.
     */
    return apply_filters( 'bp_activity_new_update_action', $action, $activity );
}

Changelog

Changelog
Version Description
BuddyPress 2.0.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.