bbp_get_author_ip( mixed $args = '' )
Return the author IP address of a post
Description
Parameters
- $args
-
(Optional) If an integer, it is used as reply id.
Default value: ''
Return
(string) Author link of reply
Source
File: bp-forums/users/template.php
function bbp_get_author_ip( $args = '' ) {
// Used as post id
$post_id = is_numeric( $args ) ? (int) $args : 0;
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'post_id' => $post_id,
'before' => '<span class="bbp-author-ip">(',
'after' => ')</span>'
), 'get_author_ip' );
// Get the author IP meta value
$author_ip = get_post_meta( $r['post_id'], '_bbp_author_ip', true );
if ( !empty( $author_ip ) ) {
$author_ip = $r['before'] . $author_ip . $r['after'];
// No IP address
} else {
$author_ip = '';
}
return apply_filters( 'bbp_get_author_ip', $author_ip, $r );
}
Changelog
| Version | Description |
|---|---|
| bbPress (r3120) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.