bbp_get_author_ip

Return the author IP address of a post.

Description

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

Returns (string)

Author link of reply

Parameters (1)

0. $args — Optional. (string) => ''
If an integer, it is used as reply id.

Usage

  1. if ( !function_exists( 'bbp_get_author_ip' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/template.php'; 
  3.  
  4. // Optional. If an integer, it is used as reply id. 
  5. $args = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_author_ip($args); 
  9.  

Defined (1)

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

/includes/users/template.php  
  1. function bbp_get_author_ip( $args = '' ) { 
  2.  
  3. // Used as post id 
  4. $post_id = is_numeric( $args ) ? (int) $args : 0; 
  5.  
  6. // Parse arguments against default values 
  7. $r = bbp_parse_args( $args, array( 
  8. 'post_id' => $post_id,  
  9. 'before' => '<span class="bbp-author-ip">(',  
  10. 'after' => ')</span>' 
  11. ), 'get_author_ip' ); 
  12.  
  13. // Get the author IP meta value 
  14. $author_ip = get_post_meta( $r['post_id'], '_bbp_author_ip', true ); 
  15. if ( !empty( $author_ip ) ) { 
  16. $author_ip = $r['before'] . $author_ip . $r['after']; 
  17.  
  18. // No IP address 
  19. } else { 
  20. $author_ip = ''; 
  21.  
  22. return apply_filters( 'bbp_get_author_ip', $author_ip, $r );