Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Css class added for user roles in topics and replies #6

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/includes/replies/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,6 @@ function bbp_reply_author_role( $args = array() ) {
* @return string Reply author role
*/
function bbp_get_reply_author_role( $args = array() ) {

// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'reply_id' => 0,
Expand All @@ -1364,6 +1363,11 @@ function bbp_get_reply_author_role( $args = array() ) {

$reply_id = bbp_get_reply_id( $r['reply_id'] );
$role = bbp_get_user_display_role( bbp_get_reply_author_id( $reply_id ) );
$css_role = sanitize_key( $role );

if ( empty( $args['before'] ) ) {
$r['before'] = '<div class="bbp-author-role bbp-role-' . esc_attr( $css_role ) . '">';
}

// Backwards compatibilty with old 'class' argument
if ( ! empty( $r['class'] ) ) {
Expand Down
6 changes: 5 additions & 1 deletion src/includes/topics/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,6 @@ function bbp_topic_author_role( $args = array() ) {
* @return string topic author role
*/
function bbp_get_topic_author_role( $args = array() ) {

// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'topic_id' => 0,
Expand All @@ -1600,6 +1599,11 @@ function bbp_get_topic_author_role( $args = array() ) {

$topic_id = bbp_get_topic_id( $r['topic_id'] );
$role = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) );
$css_role = sanitize_key( $role );

if ( empty( $args['before'] ) ) {
$r['before'] = '<div class="bbp-author-role bbp-role-' . esc_attr( $css_role ) . '">';
}

// Backwards compatibilty with old 'class' argument
if ( ! empty( $r['class'] ) ) {
Expand Down