bbp_get_reply_author_role( array $args = array() )
Return the reply author role
Description Description
Parameters Parameters
- $args
-
(Optional)
Default value: array()
Return Return
(string) Reply author role
Source Source
File: includes/replies/template.php
function bbp_get_reply_author_role( $args = array() ) {
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'reply_id' => 0,
'class' => false,
'before' => '<div class="bbp-author-role">',
'after' => '</div>'
), 'get_reply_author_role' );
$reply_id = bbp_get_reply_id( $r['reply_id'] );
$role = bbp_get_user_display_role( bbp_get_reply_author_id( $reply_id ) );
// Backwards compatibilty with old 'class' argument
if ( ! empty( $r['class'] ) ) {
$author_role = sprintf( '%1$s<div class="%2$s">%3$s</div>%4$s', $r['before'], esc_attr( $r['class'] ), esc_html( $role ), $r['after'] );
// Simpler before & after arguments
// https://bbpress.trac.wordpress.org/ticket/2557
} else {
$author_role = $r['before'] . $role . $r['after'];
}
// Filter & return
return apply_filters( 'bbp_get_reply_author_role', $author_role, $r, $args );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |