bbp_get_reply_spam_link

Return the spam link of the reply.

Description

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

Returns (string)

Reply spam 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 - spam_text: Spam text - unspam_text: Unspam text

Usage

  1. if ( !function_exists( 'bbp_get_reply_spam_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_reply_spam_link($args); 
  7.  

Defined (1)

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

/includes/replies/template.php  
  1. function bbp_get_reply_spam_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. 'spam_text' => esc_html__( 'Spam', bbpress ),  
  9. 'unspam_text' => esc_html__( 'Unspam', bbpress ) 
  10. ), 'get_reply_spam_link' ); 
  11.  
  12. $reply = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) ); 
  13.  
  14. if ( empty( $reply ) || !current_user_can( 'moderate', $reply->ID ) ) 
  15. return; 
  16.  
  17. $display = bbp_is_reply_spam( $reply->ID ) ? $r['unspam_text'] : $r['spam_text']; 
  18. $uri = add_query_arg( array( 'action' => 'bbp_toggle_reply_spam', 'reply_id' => $reply->ID ) ); 
  19. $uri = wp_nonce_url( $uri, 'spam-reply_' . $reply->ID ); 
  20. $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-spam-link">' . $display . '</a>' . $r['link_after']; 
  21.  
  22. return apply_filters( 'bbp_get_reply_spam_link', $retval, $r );