bp_get_blog_last_active( array $args = array() )

Return the last active date of the current blog in the loop.


Parameters Parameters

$args

(array) (Optional) Array of optional arguments.

  • 'active_format'
    (bool) If true, formatted "Active 5 minutes ago". If false, formatted "5 minutes ago". Default: true.

Default value: array()


Top ↑

Return Return

(string) Last active date.


Source Source

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

	function bp_get_blog_last_active( $args = array() ) {
		global $blogs_template;

		// Parse the activity format.
		$r = bp_parse_args( $args, array(
			'active_format' => true
		) );

		// Backwards compatibility for anyone forcing a 'true' active_format.
		if ( true === $r['active_format'] ) {
			/* translators: %s: human time diff of the last time the site was active. */
			$r['active_format'] = _x( 'Active %s', 'last time the site was active', 'buddypress' );
		}

		// Blog has been posted to at least once.
		if ( isset( $blogs_template->blog->last_activity ) ) {

			// Backwards compatibility for pre 1.5 'ago' strings.
			$last_activity = ! empty( $r['active_format'] )
				? bp_core_get_last_activity( $blogs_template->blog->last_activity, $r['active_format'] )
				: bp_core_time_since( $blogs_template->blog->last_activity );

		// Blog has never been posted to.
		} else {
			$last_activity = __( 'Never active', 'buddypress' );
		}

		/**
		 * Filters the last active date of the current blog in the loop.
		 *
		 * @since 1.2.0
		 *
		 * @param string $last_activity Last active date.
		 * @param array  $r             Array of parsed args used to determine formatting.
		 */
		return apply_filters( 'bp_blog_last_active', $last_activity, $r );
	}


Top ↑

User Contributed Notes User Contributed Notes

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