Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/13/2017 05:14:59 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Classes: add more author & moderator related CSS classes to helper functions.

This change adds classes to forums, topics, and replies where the respective author is also a moderator of the nearest parent forum.

See #459.

File:
1 edited

Legend:

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

    r6683 r6692  
    21772177        $reply_id  = bbp_get_reply_id( $reply_id );
    21782178        $topic_id  = bbp_get_reply_topic_id( $reply_id );
     2179        $forum_id  = bbp_get_reply_forum_id( $reply_id );
    21792180        $author_id = bbp_get_reply_author_id( $reply_id );
     2181        $reply_pos = bbp_get_reply_position( $reply_id, true );
    21802182        $classes   = array_filter( (array) $classes );
    21812183        $count     = isset( $bbp->reply_query->current_post )
     
    21832185            : 1;
    21842186
     2187        //  Stripes
     2188        $even_odd = ( $count % 2 )
     2189            ? 'even'
     2190            : 'odd';
     2191
     2192        // Forum moderator replied to topic
     2193        $forum_moderator = ( bbp_is_user_forum_moderator( $author_id, $forum_id ) === $author_id )
     2194            ? 'forum-mod'
     2195            : '';
     2196
     2197        // Topic author replied to others
     2198        $topic_author = ( bbp_get_topic_author_id( $topic_id ) === $author_id )
     2199            ? 'topic-author'
     2200            : '';
     2201
    21852202        // Get reply classes
    21862203        $reply_classes = array(
    2187             'loop-item-' . $count,
    2188             ( $count % 2                                        )   ? 'even'         : 'odd',
    2189             ( $author_id === bbp_get_topic_author_id( $topic_id ) ) ? 'topic-author' : '',
    2190             'user-id-' . $author_id,
    2191             'bbp-parent-forum-'   . bbp_get_reply_forum_id( $reply_id ),
     2204            'loop-item-'          . $count,
     2205            'user-id-'            . $author_id,
     2206            'bbp-parent-forum-'   . $forum_id,
    21922207            'bbp-parent-topic-'   . $topic_id,
    2193             'bbp-reply-position-' . bbp_get_reply_position( $reply_id, true )
     2208            'bbp-reply-position-' . $reply_pos,
     2209            $even_odd,
     2210            $topic_author,
     2211            $forum_moderator
    21942212        );
    21952213
Note: See TracChangeset for help on using the changeset viewer.