Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/16/2025 11:21:45 PM (2 months ago)
Author:
johnjamesjacoby
Message:

Topics/Replies: Add CSS class for user roles in topics/replies.

This commit improves the ability target specific author roles anywhere single topic or reply author meta is shown.

Props douglsmith, mikachan, netweb, robinwpdeveloper, rudlinkon, sirlouen.

In trunk, for 2.7.

Fixes #2692.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/topics/template.php

    r7360 r7362  
    16051605        $topic_id = bbp_get_topic_id( $r['topic_id'] );
    16061606        $role     = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) );
     1607        $css_role = sanitize_key( $role );
     1608
     1609        // Add role as CSS class to default 'before' value.
     1610        if ( empty( $args['before'] ) ) {
     1611            $r['before'] = '<div class="bbp-author-role bbp-role-' . esc_attr( $css_role ) . '">';
     1612        }
    16071613
    16081614        // Backwards compatibilty with old 'class' argument
Note: See TracChangeset for help on using the changeset viewer.