bp_get_last_activity( int $user_id )

Get the “active [x days ago]” string for a user.


Parameters Parameters

$user_id

(int) (Required) ID of the user. Default: displayed user ID.


Top ↑

Return Return

(string)


Source Source

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

	function bp_get_last_activity( $user_id = 0 ) {

		if ( empty( $user_id ) ) {
			$user_id = bp_displayed_user_id();
		}

		/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
		$last_activity = bp_core_get_last_activity( bp_get_user_last_activity( $user_id ), __( 'Active %s', 'buddypress') );

		/**
		 * Filters the 'active [x days ago]' string for a user.
		 *
		 * @since 1.5.0
		 * @since 2.6.0 Added the `$user_id` parameter.
		 *
		 * @param string $value   Formatted 'active [x days ago]' string.
		 * @param int    $user_id ID of the user.
		 */
		return apply_filters( 'bp_get_last_activity', $last_activity, $user_id );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.