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.


Parameters Parameters

$group

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

Default value: false

$args

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


Top ↑

Return Return

(string)


Source 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', 'buddypress' );
		} else {

			/**
			 * Filters the 'last active' string for the current group in the loop.
			 *
			 * @since 1.0.0
			 * @since 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 );
		}
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Added $args as a parameter.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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