bbp_get_topic_merge_link

Return the merge link of the topic.

Description

(string) bbp_get_topic_merge_link( (string) $args = '' ); 

Returns (string)

Topic merge link

Parameters (1)

0. $args — Optional. (string) => ''
This function supports these args: - id: Optional. Topic id - link_before: Before the link - link_after: After the link - merge_text: Merge text

Usage

  1. if ( !function_exists( 'bbp_get_topic_merge_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; 
  3. $args = ''; 
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_get_topic_merge_link($args); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/topics/template.php  
  1. function bbp_get_topic_merge_link( $args = '' ) { 
  2.  
  3. // Parse arguments against default values 
  4. $r = bbp_parse_args( $args, array( 
  5. 'id' => 0,  
  6. 'link_before' => '',  
  7. 'link_after' => '',  
  8. 'merge_text' => esc_html__( 'Merge', bbpress ),  
  9. ), 'get_topic_merge_link' ); 
  10.  
  11. $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) ); 
  12.  
  13. if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) 
  14. return; 
  15.  
  16. $uri = add_query_arg( array( 'action' => 'merge' ), bbp_get_topic_edit_url( $topic->ID ) ); 
  17. $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after']; 
  18.  
  19. return apply_filters( 'bbp_get_topic_merge_link', $retval, $args );