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/topics/template.php

    r6683 r6692  
    22542254     */
    22552255    function bbp_get_topic_class( $topic_id = 0, $classes = array() ) {
    2256         $bbp      = bbpress();
    2257         $topic_id = bbp_get_topic_id( $topic_id );
    2258         $classes  = array_filter( (array) $classes );
    2259         $count    = isset( $bbp->topic_query->current_post )
     2256        $bbp       = bbpress();
     2257        $topic_id  = bbp_get_topic_id( $topic_id );
     2258        $forum_id  = bbp_get_topic_forum_id( $topic_id );
     2259        $author_id = bbp_get_topic_author_id( $topic_id );
     2260        $classes   = array_filter( (array) $classes );
     2261        $count     = isset( $bbp->topic_query->current_post )
    22602262            ? (int) $bbp->topic_query->current_post
    22612263            : 1;
    22622264
     2265        //  Stripes
     2266        $even_odd = ( $count % 2 )
     2267            ? 'even'
     2268            : 'odd';
     2269
     2270        // Forum moderator replied to topic
     2271        $forum_moderator = ( bbp_is_user_forum_moderator( $author_id, $forum_id ) === $author_id )
     2272            ? 'forum-mod'
     2273            : '';
     2274
     2275        // Is this topic a sticky?
     2276        $sticky = bbp_is_topic_sticky( $topic_id, false )
     2277            ? 'sticky'
     2278            : '';
     2279
     2280        // Is this topic a super-sticky?
     2281        $super_sticky = bbp_is_topic_super_sticky( $topic_id  )
     2282            ? 'super-sticky'
     2283            : '';
     2284
    22632285        // Get topic classes
    22642286        $topic_classes = array(
    2265             'loop-item-' . $count,
    2266             ( $count % 2 )                          ? 'even'         : 'odd',
    2267             bbp_is_topic_sticky( $topic_id, false ) ? 'sticky'       : '',
    2268             bbp_is_topic_super_sticky( $topic_id  ) ? 'super-sticky' : '',
    2269             'bbp-parent-forum-' . bbp_get_topic_forum_id( $topic_id ),
    2270             'user-id-' . bbp_get_topic_author_id( $topic_id )
     2287            'loop-item-'        . $count,
     2288            'user-id-'          . $author_id,
     2289            'bbp-parent-forum-' . $forum_id,
     2290            $even_odd,
     2291            $forum_moderator,
     2292            $sticky,
     2293            $super_sticky
    22712294        );
    22722295
Note: See TracChangeset for help on using the changeset viewer.