Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/21/2017 06:19:56 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Meta: Filter _count_int and enforce integer values.

Also use convenience functions for forum post counts, to ensure proper filters are ran against all meta values.

See #3059.

File:
1 edited

Legend:

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

    r6291 r6296  
    14291429     * @param boolean $integer Optional. Whether or not to format the result
    14301430     * @uses bbp_get_forum_id() To get the forum id
    1431      * @uses get_post_meta() To get the forum post count
     1431     * @uses bbp_get_forum_topic_count() To get the topic count
     1432     * @uses bbp_get_forum_reply_count() To get the reply count
    14321433     * @uses apply_filters() Calls 'bbp_get_forum_post_count' with the
    14331434     *                        post count and forum id
     
    14371438        $forum_id = bbp_get_forum_id( $forum_id );
    14381439        $topics   = bbp_get_forum_topic_count( $forum_id, $total_count, true );
    1439         $meta_key = empty( $total_count ) ? '_bbp_reply_count' : '_bbp_total_reply_count';
    1440         $replies  = (int) get_post_meta( $forum_id, $meta_key, true );
     1440        $replies  = bbp_get_forum_reply_count( $forum_id, $total_count, true );
    14411441        $retval   = $replies + $topics;
    1442         $filter   = ( true === $integer ) ? 'bbp_get_forum_post_count_int' : 'bbp_get_forum_post_count';
     1442        $filter   = ( true === $integer )
     1443                ? 'bbp_get_forum_post_count_int'
     1444                : 'bbp_get_forum_post_count';
    14431445
    14441446        return apply_filters( $filter, $retval, $forum_id );
Note: See TracChangeset for help on using the changeset viewer.