bbp_get_topic_split_link

Get split topic link.

Description

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

Return the split link of the topic (but is bundled with each reply)

Returns (string)

Topic split link

Parameters (1)

0. $args — Optional. (string) => ''
This function supports these arguments: - id: Reply id - link_before: HTML before the link - link_after: HTML after the link - split_text: Split text - split_title: Split title attribute

Usage

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

Defined (1)

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

/includes/replies/template.php  
  1. function bbp_get_topic_split_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. 'split_text' => esc_html__( 'Split', bbpress ),  
  9. 'split_title' => esc_attr__( 'Split the topic from this reply', bbpress ) 
  10. ), 'get_topic_split_link' ); 
  11.  
  12. $reply_id = bbp_get_reply_id( $r['id'] ); 
  13. $topic_id = bbp_get_reply_topic_id( $reply_id ); 
  14.  
  15. if ( empty( $reply_id ) || !current_user_can( 'moderate', $topic_id ) ) 
  16. return; 
  17.  
  18. $uri = add_query_arg( array( 
  19. 'action' => 'split',  
  20. 'reply_id' => $reply_id 
  21. ), bbp_get_topic_edit_url( $topic_id ) ); 
  22.  
  23. $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" title="' . $r['split_title'] . '" class="bbp-topic-split-link">' . $r['split_text'] . '</a>' . $r['link_after']; 
  24.  
  25. return apply_filters( 'bbp_get_topic_split_link', $retval, $r );