bbp_get_topic_replies_link( int $topic_id )

Return the replies link of the topic

Description

Parameters

$topic_id

(Optional) Topic id

Source

File: bp-forums/topics/template.php

2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
function bbp_get_topic_replies_link( $topic_id = 0 ) {
 
    $topic    = bbp_get_topic( bbp_get_topic_id( (int) $topic_id ) );
    $topic_id = $topic->ID;
    $replies  = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), 'buddyboss' ), bbp_get_topic_reply_count( $topic_id ) );
    $retval   = '';
 
    // First link never has view=all
    if ( bbp_get_view_all( 'edit_others_replies' ) )
        $retval .= "<a href='" . esc_url( bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) ) ) . "'>$replies</a>";
    else
        $retval .= $replies;
 
    // Any deleted replies?
    $deleted = bbp_get_topic_reply_count_hidden( $topic_id );
 
    // This forum has hidden topics
    if ( !empty( $deleted ) && current_user_can( 'edit_others_replies' ) ) {
 
        // Extra text
        $extra = sprintf( __( ' (+ %d hidden)', 'buddyboss' ), $deleted );
 
        // No link
        if ( bbp_get_view_all() ) {
            $retval .= " $extra";
 
        // Link
        } else {
            $retval .= " <a href='" . esc_url( bbp_add_view_all( bbp_get_topic_permalink( $topic_id ), true ) ) . "'>$extra</a>";
        }
    }
 
    return apply_filters( 'bbp_get_topic_replies_link', $retval, $topic_id );
}

Changelog

Changelog
Version Description
bbPress (r2740) 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.