BP_REST_Forums_Endpoint::get_forum_last_active_time( int $forum_id )

Last active time for forum.

Description

Parameters

$forum_id

(Required) ID of the forum.

Return

(string)

Source

File: bp-forums/classes/class-bp-rest-forums-endpoint.php

1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
public function get_forum_last_active_time( $forum_id ) {
    $last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true );
    if ( empty( $last_active ) ) {
        $reply_id = bbp_get_forum_last_reply_id( $forum_id );
        if ( ! empty( $reply_id ) ) {
            $last_active = get_post_field( 'post_date', $reply_id );
        } else {
            $topic_id = bbp_get_forum_last_topic_id( $forum_id );
            if ( ! empty( $topic_id ) ) {
                $last_active = $this->bbp_rest_get_topic_last_active_time( $topic_id );
            } else {
                $last_active = get_post_field( 'post_date', $forum_id );
            }
        }
    }
 
    return get_gmt_from_date( $last_active );
}

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.