bbp_get_topic_replies_link

Return the replies link of the topic.

Description

bbp_get_topic_replies_link( (int) $topic_id = 0 ); 

Parameters (1)

0. $topic_id — Optional. (int)
Topic id

Usage

  1. if ( !function_exists( 'bbp_get_topic_replies_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; 
  3.  
  4. // Optional. Topic id 
  5. $topic_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_topic_replies_link($topic_id); 
  9.  

Defined (1)

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

/includes/topics/template.php  
  1. function bbp_get_topic_replies_link( $topic_id = 0 ) { 
  2.  
  3. $topic = bbp_get_topic( bbp_get_topic_id( (int) $topic_id ) ); 
  4. $topic_id = $topic->ID; 
  5. $replies = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), bbpress ), bbp_get_topic_reply_count( $topic_id ) ); 
  6. $retval = ''; 
  7.  
  8. // First link never has view=all 
  9. if ( bbp_get_view_all( 'edit_others_replies' ) ) 
  10. $retval .= "<a href='" . esc_url( bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) ) ) . "'>$replies</a>"; 
  11. else 
  12. $retval .= $replies; 
  13.  
  14. // Any deleted replies? 
  15. $deleted = bbp_get_topic_reply_count_hidden( $topic_id ); 
  16.  
  17. // This forum has hidden topics 
  18. if ( !empty( $deleted ) && current_user_can( 'edit_others_replies' ) ) { 
  19.  
  20. // Extra text 
  21. $extra = sprintf( __( ' (+ %d hidden)', bbpress ), $deleted ); 
  22.  
  23. // No link 
  24. if ( bbp_get_view_all() ) { 
  25. $retval .= " $extra"; 
  26.  
  27. // Link 
  28. } else { 
  29. $retval .= " <a href='" . esc_url( bbp_add_view_all( bbp_get_topic_permalink( $topic_id ), true ) ) . "'>$extra</a>"; 
  30.  
  31. return apply_filters( 'bbp_get_topic_replies_link', $retval, $topic_id );