bbp_get_topic_reply_link( array $args = array() )

Return the link to go directly to the reply form

Description

Parameters

$args

(Optional) Arguments

Default value: array()

Return

(string) Link for a reply to a topic

Source

File: bp-forums/topics/template.php

3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
function bbp_get_topic_reply_link( $args = array() ) {
 
    // Parse arguments against default values
    $r = bbp_parse_args( $args, array(
        'id'           => 0,
        'link_before'  => '',
        'link_after'   => '',
        'reply_text'   => esc_html__( 'Reply', 'buddyboss' ),
    ), 'get_topic_reply_link' );
 
    // Get the reply to use it's ID and post_parent
    $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
 
    // Bail if no reply or user cannot reply
    if ( empty( $topic ) || ! bbp_current_user_can_access_create_reply_form() )
        return;
 
    $uri = '#new-post';
 
    // Add $uri to the array, to be passed through the filter
    $r['uri'] = $uri;
    $retval   = $r['link_before'] . '<a href="' . esc_url( $r['uri'] ) . '" data-modal-id="bbp-reply-form" class="bbp-topic-reply-link">' . $r['reply_text'] . '</a>' . $r['link_after'];
 
    return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args );
}

Changelog

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