Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/02/2011 06:21:14 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Use get_post_class() to fix premature echo of forum/topic/reply post classes. See #1650, r3543. (2.1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r3558 r3571  
    19311931     * @uses bbp_is_topic_super_sticky() To check if the topic is a super
    19321932     *                                    sticky
    1933      * @uses post_class() To get the topic classes
     1933     * @uses get_post_class() To get the topic classes
    19341934     * @uses apply_filters() Calls 'bbp_get_topic_class' with the classes
    19351935     *                        and topic id
     
    19391939        global $bbp;
    19401940
     1941        $topic_id  = bbp_get_topic_id( $topic_id );
     1942        $count     = isset( $bbp->topic_query->current_post ) ? $bbp->topic_query->current_post : 1;
    19411943        $classes   = array();
    1942         $classes[] = $bbp->topic_query->current_post % 2     ? 'even'         : 'odd';
     1944        $classes[] = ( (int) $count % 2 )                    ? 'even'         : 'odd';
    19431945        $classes[] = bbp_is_topic_sticky( $topic_id, false ) ? 'sticky'       : '';
    19441946        $classes[] = bbp_is_topic_super_sticky( $topic_id  ) ? 'super-sticky' : '';
    19451947        $classes   = array_filter( $classes );
    1946         $post      = post_class( $classes, $topic_id );
    1947 
    1948         return apply_filters( 'bbp_get_topic_class', $post, $topic_id );
     1948        $retval    = get_post_class( $classes, $topic_id );
     1949        $retval    = 'class="' . join( ' ', $retval ) . '"';
     1950
     1951        return apply_filters( 'bbp_get_topic_class', $retval, $topic_id );
    19491952    }
    19501953
Note: See TracChangeset for help on using the changeset viewer.