Skip to:
Content

bbPress.org

Ticket #2519: 2519.6.patch

File 2519.6.patch, 6.9 KB (added by netweb, 11 years ago)
  • src/includes/users/template.php

     
    594594                // Parse arguments against default values
    595595                $r = bbp_parse_args( $args, array(
    596596                        'post_id' => $post_id,
    597                         'before'  => '<span class="bbp-author-ip">(',
    598                         'after'   => ')</span>'
     597                        'before'  => '<div class="bbp-reply-ip"><span class="bbp-author-ip">(',
     598                        'after'   => ')</span></div>'
    599599                ), 'get_author_ip' );
    600600
    601601                // Get the author IP meta value
     
    611611                return apply_filters( 'bbp_get_author_ip', $author_ip, $r );
    612612        }
    613613
     614
     615/** User Topic and Reply Display Counts ***************************************/
     616
     617/**
     618 * Output the user topic counts
     619 *
     620 * @since bbPress (rXXXX)
     621 *
     622 * @param mixed $args Optional. If an integer, it is used as user id.
     623 * @uses bbp_get_author_display_topic_count() To get the user topic counts
     624 */
     625function bbp_author_display_topic_count( $args = '' ) {
     626        echo bbp_get_author_display_topic_count( $args );
     627}
     628        /**
     629         * Return the user topic counts
     630         *
     631         * @since bbPress (rXXXX)
     632         *
     633         * @param mixed $args Optional. If an integer, it is used as user id.
     634         * @uses apply_filters Calls 'bbp_no_author_display_topic_count' to
     635         *                      not display users topics started counts
     636         * @uses bbp_get_user_id() To get the user id
     637         * @uses bbp_get_user_topic_count To get the users topics started count
     638         * @uses apply_filters() Calls 'bbp_get_author_display_topic_count' with the
     639         *                        topics started count and args
     640         * @return string Users topics started count
     641         */
     642        function bbp_get_author_display_topic_count( $args = '' ) {
     643
     644                // Turn off author displayed topic counts
     645                if ( apply_filters( 'bbp_no_author_display_topic_count', is_front_page() ) ) {
     646                        return;
     647                }
     648
     649                // Parse arguments against default values
     650                $r = bbp_parse_args( $args, array(
     651                        'post_id' => 0,
     652                        'before'  => '<div class="bbp-author-topic-count">',
     653                        'title'   => __('Topics Started: ', 'bbpress'),
     654                        'after'   => '</div>'
     655                ), 'get_author_display_topic_count' );
     656
     657                // Used as user id
     658                if ( is_numeric( $args ) ) {
     659                        $user_id = bbp_get_user_id( $args );
     660                }
     661
     662                // Validate the user ID
     663                if ( ! empty( $user_id ) ) {
     664
     665                        // Get the users topic count
     666                        $topic_count = bbp_get_user_topic_count( $user_id );
     667                        $topic_count = $r['before'] . $r['title'] . $topic_count . $r['after'];
     668                }
     669
     670                return apply_filters( 'bbp_get_author_display_topic_count', $topic_count, $r );
     671        }
     672
     673/**
     674 * Output the user reply counts
     675 *
     676 * @since bbPress (rXXXX)
     677 *
     678 * @param mixed $args Optional. If an integer, it is used as user id.
     679 * @uses bbp_get_author_display_reply_count() To get the user reply counts
     680 */
     681function bbp_author_display_reply_count( $args = '' ) {
     682        echo bbp_get_author_display_reply_count( $args );
     683}
     684        /**
     685         * Return the user reply counts
     686         *
     687         * @since bbPress (rXXXX)
     688         *
     689         * @param mixed $args Optional. If an integer, it is used as user id.
     690         * @uses apply_filters Calls 'bbp_no_author_display_reply_count' to
     691         *                      not display user replies created counts
     692         * @uses bbp_get_user_id() To get the user id
     693         * @uses bbp_get_user_reply_count To get the users replies created count
     694         * @uses apply_filters() Calls 'bbp_get_author_display_reply_count' with the
     695         *                        topics started count and args
     696         * @return string Users replies created count
     697         */
     698        function bbp_get_author_display_reply_count( $args = '' ) {
     699
     700                // Turn off author author displayed reply counts
     701                if ( apply_filters( 'bbp_no_author_display_reply_count', is_front_page() ) ) {
     702                        return;
     703                }
     704
     705                // Parse arguments against default values
     706                $r = bbp_parse_args( $args, array(
     707                        'post_id' => 0,
     708                        'before'  => '<div class="bbp-author-reply-count">',
     709                        'title'   => __('Replies Created: ', 'bbpress'),
     710                        'after'   => '</div>'
     711                ), 'get_author_display_reply_count' );
     712
     713                // Used as user id
     714                if ( is_numeric( $args ) ) {
     715                        $user_id = bbp_get_user_id( $args );
     716                }
     717
     718                // Validate the user ID
     719                if ( ! empty( $user_id ) ) {
     720
     721                        // Get the users reply count
     722                        $reply_count = bbp_get_user_reply_count( $user_id );
     723                        $reply_count = $r['before'] . $r['title'] . $reply_count . $r['after'];
     724                }
     725
     726                return apply_filters( 'bbp_get_author_display_reply_count', $reply_count, $r );
     727        }
     728
    614729/** Anonymous Fields **********************************************************/
    615730
    616731/**
     
    13771492                return apply_filters( 'bbp_get_user_topics_created_url', $url, $user_id );
    13781493        }
    13791494
    1380 /** Topics Created ************************************************************/
     1495/** Replies Created ************************************************************/
    13811496
    13821497/**
    13831498 * Output the link to the user's replies
  • src/templates/default/bbpress/content-single-topic-lead.php

     
    6161
    6262                                        <?php do_action( 'bbp_theme_before_topic_author_admin_details' ); ?>
    6363
    64                                         <div class="bbp-topic-ip"><?php bbp_author_ip( bbp_get_topic_id() ); ?></div>
     64                                        <?php bbp_author_ip( bbp_get_topic_id() ); ?>
    6565
    6666                                        <?php do_action( 'bbp_theme_after_topic_author_admin_details' ); ?>
    6767
    6868                                <?php endif; ?>
    6969
     70                                <?php if ( ! bbp_is_topic_anonymous() ) : ?>
     71
     72                                        <?php do_action( 'bbp_theme_before_topic_author_count_details' ); ?>
     73
     74                                        <?php bbp_author_display_topic_count( bbp_get_topic_author_id() ); ?>
     75
     76                                        <?php bbp_author_display_reply_count( bbp_get_topic_author_id() ); ?>
     77
     78                                        <?php do_action( 'bbp_theme_after_topic_author_count_details' ); ?>
     79
     80                                <?php endif; ?>
     81
    7082                                <?php do_action( 'bbp_theme_after_topic_author_details' ); ?>
    7183
    7284                        </div><!-- .bbp-topic-author -->
  • src/templates/default/bbpress/loop-single-reply.php

     
    4848
    4949                        <?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?>
    5050
    51                         <div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_reply_id() ); ?></div>
     51                        <?php bbp_author_ip( bbp_get_reply_id() ); ?>
    5252
    5353                        <?php do_action( 'bbp_theme_after_reply_author_admin_details' ); ?>
    5454
    5555                <?php endif; ?>
    5656
     57                <?php if ( ! bbp_is_reply_anonymous() ) : ?>
     58
     59                        <?php do_action( 'bbp_theme_before_reply_author_count_details' ); ?>
     60
     61                        <?php bbp_author_display_topic_count( bbp_get_reply_author_id() ); ?>
     62
     63                        <?php bbp_author_display_reply_count( bbp_get_reply_author_id() ); ?>
     64
     65                        <?php do_action( 'bbp_theme_after_reply_author_count_details' ); ?>
     66
     67                <?php endif; ?>
     68
    5769                <?php do_action( 'bbp_theme_after_reply_author_details' ); ?>
    5870
    5971        </div><!-- .bbp-reply-author -->