bbp_get_topic_author_role( array $args = array() )
Return the topic author role
Description Description
Parameters Parameters
- $args
-
(Optional)
Default value: array()
Return Return
(string) topic author role
Source Source
File: includes/topics/template.php
function bbp_get_topic_author_role( $args = array() ) {
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'topic_id' => 0,
'class' => false,
'before' => '<div class="bbp-author-role">',
'after' => '</div>'
), 'get_topic_author_role' );
$topic_id = bbp_get_topic_id( $r['topic_id'] );
$role = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_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'], $r['class'], $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_topic_author_role', $author_role, $r );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |