bbp_get_topic_merge_link( mixed $args = '' )

Return the merge link of the topic

Description

Parameters

$args

(Optional) This function supports these args: - id: Optional. Topic id - link_before: Before the link - link_after: After the link - merge_text: Merge text

Default value: ''

Return

(string) Topic merge link

Source

File: bp-forums/topics/template.php

2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
function bbp_get_topic_merge_link( $args = '' ) {
 
    // Parse arguments against default values
    $r = bbp_parse_args( $args, array(
        'id'           => 0,
        'link_before'  => '',
        'link_after'   => '',
        'merge_text'   => esc_html__( 'Merge', 'buddyboss' ),
    ), 'get_topic_merge_link' );
 
    $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
 
    if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) )
        return;
 
    $uri    = add_query_arg( array( 'action' => 'merge' ), bbp_get_topic_edit_url( $topic->ID ) );
    $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after'];
 
    return apply_filters( 'bbp_get_topic_merge_link', $retval, $args );
}

Changelog

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