bbp_update_topic_last_active_time( int $topic_id, string $new_time = '' )
Update the topics last active date/time (aka freshness)
Description Description
Parameters Parameters
- $topic_id
-
(Optional) Topic id.
- $new_time
-
(Optional) New time in mysql format.
Default value: ''
Return Return
(string) MySQL timestamp of last active reply
Source Source
File: includes/topics/functions.php
function bbp_update_topic_last_active_time( $topic_id = 0, $new_time = '' ) { // If it's a reply, then get the parent (topic id) $topic_id = bbp_is_reply( $topic_id ) ? bbp_get_reply_topic_id( $topic_id ) : bbp_get_topic_id( $topic_id ); // Check time and use current if empty if ( empty( $new_time ) ) { $new_time = get_post_field( 'post_date', bbp_get_public_child_last_id( $topic_id, bbp_get_reply_post_type() ) ); } // Update only if published if ( ! empty( $new_time ) ) { update_post_meta( $topic_id, '_bbp_last_active_time', $new_time ); } // Filter & return return apply_filters( 'bbp_update_topic_last_active_time', $new_time, $topic_id ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |