bbp_update_forum_last_active_time( int $forum_id, string $new_time = '' )

Update the forums last active date/time (aka freshness)


Description Description


Parameters Parameters

$forum_id

(Optional) Topic id.

$new_time

(Optional) New time in mysql format.

Default value: ''


Top ↑

Return Return

(string) MySQL timestamp of last active topic or reply


Top ↑

Source Source

File: includes/forums/functions.php

function bbp_update_forum_last_active_time( $forum_id = 0, $new_time = '' ) {
	$forum_id = bbp_get_forum_id( $forum_id );

	// Check time and use current if empty
	if ( empty( $new_time ) ) {
		$new_time = get_post_field( 'post_date', bbp_get_forum_last_active_id( $forum_id ) );
	}

	// Update only if there is a time
	if ( ! empty( $new_time ) ) {
		update_post_meta( $forum_id, '_bbp_last_active_time', $new_time );
	}

	// Filter & return
	return apply_filters( 'bbp_update_forum_last_active', $new_time, $forum_id );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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