bp_get_blog_last_active( array $args = array() )

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

Description

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()

Return

(string) Last active date.

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'] ) {
			$r['active_format'] = __( 'active %s', 'buddyboss' );
		}

		// 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', 'buddyboss' );
		}

		/**
		 * Filters the last active date of the current blog in the loop.
		 *
		 * @since BuddyPress 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 );
	}

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.