Changeset 6055 for trunk/src/includes/common/functions.php
- Timestamp:
- 06/05/2016 02:21:41 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/common/functions.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/functions.php
r6050 r6055 417 417 * 418 418 * @since 2.0.0 bbPress (r2769) 419 * @since 2.6.0 bbPress (r6055) Introduced the `count_pending_topics` and 420 * `count_pending_replies` arguments. 419 421 * 420 422 * @param array $args Optional. The function supports these arguments (all … … 424 426 * - count_topics: Count topics? If set to false, private, spammed and trashed 425 427 * topics are also not counted. 428 * - count_pending_topics: Count pending topics? (only counted if the current 429 * user has edit_others_topics cap) 426 430 * - count_private_topics: Count private topics? (only counted if the current 427 431 * user has read_private_topics cap) … … 432 436 * - count_replies: Count replies? If set to false, private, spammed and 433 437 * trashed replies are also not counted. 438 * - count_pending_replies: Count pending replies? (only counted if the current 439 * user has edit_others_replies cap) 434 440 * - count_private_replies: Count private replies? (only counted if the current 435 441 * user has read_private_replies cap) … … 440 446 * - count_tags: Count tags? If set to false, empty tags are also not counted 441 447 * - count_empty_tags: Count empty tags? 442 * @uses bbp_ count_users() To count the number of registered users448 * @uses bbp_get_total_users() To count the number of registered users 443 449 * @uses bbp_get_forum_post_type() To get the forum post type 444 450 * @uses bbp_get_topic_post_type() To get the topic post type … … 458 464 'count_forums' => true, 459 465 'count_topics' => true, 466 'count_pending_topics' => true, 460 467 'count_private_topics' => true, 461 468 'count_spammed_topics' => true, 462 469 'count_trashed_topics' => true, 463 470 'count_replies' => true, 471 'count_pending_replies' => true, 464 472 'count_private_replies' => true, 465 473 'count_spammed_replies' => true, … … 490 498 491 499 // Post statuses 500 $pending = bbp_get_pending_status_id(); 492 501 $private = bbp_get_private_status_id(); 493 502 $spam = bbp_get_spam_status_id(); … … 504 513 if ( current_user_can( 'read_private_topics' ) || current_user_can( 'edit_others_topics' ) || current_user_can( 'view_trash' ) ) { 505 514 515 // Pending 516 $topics['pending'] = ( ! empty( $r['count_pending_topics'] ) && current_user_can( 'edit_others_topics' ) ) ? (int) $all_topics->{$pending} : 0; 517 506 518 // Private 507 519 $topics['private'] = ( ! empty( $r['count_private_topics'] ) && current_user_can( 'read_private_topics' ) ) ? (int) $all_topics->{$private} : 0; … … 514 526 515 527 // Total hidden (private + spam + trash) 516 $topic_count_hidden = $topics['p rivate'] + $topics['spammed'] + $topics['trashed'];528 $topic_count_hidden = $topics['pending'] + $topics['private'] + $topics['spammed'] + $topics['trashed']; 517 529 518 530 // Generate the hidden topic count's title attribute 531 $topic_titles[] = ! empty( $topics['pending'] ) ? sprintf( __( 'Pending: %s', 'bbpress' ), number_format_i18n( $topics['pending'] ) ) : ''; 519 532 $topic_titles[] = ! empty( $topics['private'] ) ? sprintf( __( 'Private: %s', 'bbpress' ), number_format_i18n( $topics['private'] ) ) : ''; 520 533 $topic_titles[] = ! empty( $topics['spammed'] ) ? sprintf( __( 'Spammed: %s', 'bbpress' ), number_format_i18n( $topics['spammed'] ) ) : ''; … … 536 549 if ( current_user_can( 'read_private_replies' ) || current_user_can( 'edit_others_replies' ) || current_user_can( 'view_trash' ) ) { 537 550 551 // Pending 552 $replies['pending'] = ( ! empty( $r['count_pending_replies'] ) && current_user_can( 'edit_others_replies' ) ) ? (int) $all_replies->{$pending} : 0; 553 538 554 // Private 539 555 $replies['private'] = ( ! empty( $r['count_private_replies'] ) && current_user_can( 'read_private_replies' ) ) ? (int) $all_replies->{$private} : 0; … … 546 562 547 563 // Total hidden (private + spam + trash) 548 $reply_count_hidden = $replies['p rivate'] + $replies['spammed'] + $replies['trashed'];564 $reply_count_hidden = $replies['pending'] + $replies['private'] + $replies['spammed'] + $replies['trashed']; 549 565 550 566 // Generate the hidden topic count's title attribute 567 $reply_titles[] = ! empty( $replies['pending'] ) ? sprintf( __( 'Pending: %s', 'bbpress' ), number_format_i18n( $replies['pending'] ) ) : ''; 551 568 $reply_titles[] = ! empty( $replies['private'] ) ? sprintf( __( 'Private: %s', 'bbpress' ), number_format_i18n( $replies['private'] ) ) : ''; 552 569 $reply_titles[] = ! empty( $replies['spammed'] ) ? sprintf( __( 'Spammed: %s', 'bbpress' ), number_format_i18n( $replies['spammed'] ) ) : '';
Note: See TracChangeset
for help on using the changeset viewer.