bp_get_group_last_active( object|bool $group = false, array|string $args = array() )

Return the ‘last active’ string for the current group in the loop.

Description

Parameters

$group

(Optional) Group object. Default: current group in loop.

Default value: false

$args

(Optional) Array of optional parameters.

  • 'relative'
    (bool) Optional. If true, returns relative activity date. eg. active 5 months ago. If false, returns active date value from database. Default: true.

Default value: array()

Return

(string)

Source

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

	function bp_get_group_last_active( $group = false, $args = array() ) {
		global $groups_template;

		if ( empty( $group ) ) {
			$group =& $groups_template->group;
		}

		$r = bp_parse_args( $args, array(
			'relative' => true,
		), 'group_last_active' );

		$last_active = $group->last_activity;
		if ( ! $last_active ) {
			$last_active = groups_get_groupmeta( $group->id, 'last_activity' );
		}

		// We do not want relative time, so return now.
		// @todo Should the 'bp_get_group_last_active' filter be applied here?
		if ( ! $r['relative'] ) {
			return esc_attr( $last_active );
		}

		if ( empty( $last_active ) ) {
			return __( 'not yet active', 'buddyboss' );
		} else {

			/**
			 * Filters the 'last active' string for the current group in the loop.
			 *
			 * @since BuddyPress 1.0.0
			 * @since BuddyPress 2.5.0 Added the `$group` parameter.
			 *
			 * @param string $value Determined last active value for the current group.
			 * @param object $group Group object.
			 */
			return apply_filters( 'bp_get_group_last_active', bp_core_time_since( $last_active ), $group );
		}
	}

Changelog

Changelog
Version Description
BuddyPress 2.7.0 Added $args as a parameter. BuddyPress 2.7.0 Added $args as a parameter.
BuddyPress 1.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.