| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Output the unique id of the custom post type for forums |
| 17 | 17 | * |
| 18 | - * @since 2.0.0 bbPress (r2857) | |
| 18 | + * @since 2.0.0 bbPress (r2858) | |
| 19 | 19 | */ |
| 20 | 20 | function bbp_forum_post_type() { |
| 21 | 21 | echo bbp_get_forum_post_type(); |
| 22 | 22 | } |
| @@ -22,9 +22,9 @@ | ||
| 22 | 22 | } |
| 23 | 23 | /** |
| 24 | 24 | * Return the unique id of the custom post type for forums |
| 25 | 25 | * |
| 26 | - * @since 2.0.0 bbPress (r2857) | |
| 26 | + * @since 2.0.0 bbPress (r2858) | |
| 27 | 27 | * |
| 28 | 28 | * @return string The unique forum post type id |
| 29 | 29 | */ |
| 30 | 30 | function bbp_get_forum_post_type() { |
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Return array of labels used by the forum post type |
| 39 | 39 | * |
| 40 | - * @since 2.5.0 bbPress (r5129) | |
| 40 | + * @since 2.5.0 bbPress (r5130) | |
| 41 | 41 | * |
| 42 | 42 | * @return array |
| 43 | 43 | */ |
| 44 | 44 | function bbp_get_forum_post_type_labels() { |
| @@ -85,9 +85,9 @@ | ||
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * Return array of forum post type rewrite settings |
| 88 | 88 | * |
| 89 | - * @since 2.5.0 bbPress (r5129) | |
| 89 | + * @since 2.5.0 bbPress (r5130) | |
| 90 | 90 | * |
| 91 | 91 | * @return array |
| 92 | 92 | */ |
| 93 | 93 | function bbp_get_forum_post_type_rewrite() { |
| @@ -104,9 +104,9 @@ | ||
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * Return array of features the forum post type supports |
| 107 | 107 | * |
| 108 | - * @since 2.5.0 bbPress (r5129) | |
| 108 | + * @since 2.5.0 bbPress (r5130) | |
| 109 | 109 | * |
| 110 | 110 | * @return array |
| 111 | 111 | */ |
| 112 | 112 | function bbp_get_forum_post_type_supports() { |
| @@ -389,9 +389,9 @@ | ||
| 389 | 389 | |
| 390 | 390 | /** |
| 391 | 391 | * Output the forum archive title |
| 392 | 392 | * |
| 393 | - * @since 2.0.0 bbPress (r3249) | |
| 393 | + * @since 2.0.0 bbPress (r3250) | |
| 394 | 394 | * |
| 395 | 395 | * @param string $title Default text to use as title |
| 396 | 396 | */ |
| 397 | 397 | function bbp_forum_archive_title( $title = '' ) { |
| @@ -399,9 +399,9 @@ | ||
| 399 | 399 | } |
| 400 | 400 | /** |
| 401 | 401 | * Return the forum archive title |
| 402 | 402 | * |
| 403 | - * @since 2.0.0 bbPress (r3249) | |
| 403 | + * @since 2.0.0 bbPress (r3250) | |
| 404 | 404 | * |
| 405 | 405 | * @param string $title Default text to use as title |
| 406 | 406 | * |
| 407 | 407 | * @return string The forum archive title |
| @@ -429,9 +429,9 @@ | ||
| 429 | 429 | |
| 430 | 430 | /** |
| 431 | 431 | * Output the content of the forum |
| 432 | 432 | * |
| 433 | - * @since 2.0.0 bbPress (r2780) | |
| 433 | + * @since 2.0.0 bbPress (r2794) | |
| 434 | 434 | * |
| 435 | 435 | * @param int $forum_id Optional. Topic id |
| 436 | 436 | */ |
| 437 | 437 | function bbp_forum_content( $forum_id = 0 ) { |
| @@ -439,9 +439,9 @@ | ||
| 439 | 439 | } |
| 440 | 440 | /** |
| 441 | 441 | * Return the content of the forum |
| 442 | 442 | * |
| 443 | - * @since 2.0.0 bbPress (r2780) | |
| 443 | + * @since 2.0.0 bbPress (r2794) | |
| 444 | 444 | * |
| 445 | 445 | * @param int $forum_id Optional. Topic id |
| 446 | 446 | * |
| 447 | 447 | * @return string Content of the forum |
| @@ -448,11 +448,12 @@ | ||
| 448 | 448 | */ |
| 449 | 449 | function bbp_get_forum_content( $forum_id = 0 ) { |
| 450 | 450 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 451 | 451 | |
| 452 | - // Check if password is required | |
| 453 | - if ( post_password_required( $forum_id ) ) { | |
| 454 | - return get_the_password_form(); | |
| 452 | + // Check the forum and its ancestors. | |
| 453 | + $password_id = bbp_get_password_required_id( $forum_id ); | |
| 454 | + if ( ! empty( $password_id ) ) { | |
| 455 | + return get_the_password_form( $password_id ); | |
| 455 | 456 | } |
| 456 | 457 | |
| 457 | 458 | $content = get_post_field( 'post_content', $forum_id ); |
| 458 | 459 | |
| @@ -462,9 +463,9 @@ | ||
| 462 | 463 | |
| 463 | 464 | /** |
| 464 | 465 | * Allow forum rows to have administrative actions |
| 465 | 466 | * |
| 466 | - * @since 2.1.0 bbPress (r3653) | |
| 467 | + * @since 2.1.0 bbPress (r3654) | |
| 467 | 468 | * |
| 468 | 469 | * @todo Links and filter |
| 469 | 470 | */ |
| 470 | 471 | function bbp_forum_row_actions() { |
| @@ -473,9 +474,9 @@ | ||
| 473 | 474 | |
| 474 | 475 | /** |
| 475 | 476 | * Output the forums last active ID |
| 476 | 477 | * |
| 477 | - * @since 2.0.0 bbPress (r2860) | |
| 478 | + * @since 2.0.0 bbPress (r2876) | |
| 478 | 479 | * |
| 479 | 480 | * @param int $forum_id Optional. Forum id |
| 480 | 481 | */ |
| 481 | 482 | function bbp_forum_last_active_id( $forum_id = 0 ) { |
| @@ -483,9 +484,9 @@ | ||
| 483 | 484 | } |
| 484 | 485 | /** |
| 485 | 486 | * Return the forums last active ID |
| 486 | 487 | * |
| 487 | - * @since 2.0.0 bbPress (r2860) | |
| 488 | + * @since 2.0.0 bbPress (r2876) | |
| 488 | 489 | * |
| 489 | 490 | * @param int $forum_id Optional. Forum id |
| 490 | 491 | * the last active id and forum id |
| 491 | 492 | * @return int Forum's last active id |
| @@ -500,9 +501,9 @@ | ||
| 500 | 501 | |
| 501 | 502 | /** |
| 502 | 503 | * Output the forums last update date/time (aka freshness) |
| 503 | 504 | * |
| 504 | - * @since 2.0.0 bbPress (r2464) | |
| 505 | + * @since 2.0.0 bbPress (r2876) | |
| 505 | 506 | * |
| 506 | 507 | * @param int $forum_id Optional. Forum id |
| 507 | 508 | */ |
| 508 | 509 | function bbp_forum_last_active_time( $forum_id = 0 ) { |
| @@ -510,9 +511,9 @@ | ||
| 510 | 511 | } |
| 511 | 512 | /** |
| 512 | 513 | * Return the forums last update date/time (aka freshness) |
| 513 | 514 | * |
| 514 | - * @since 2.0.0 bbPress (r2464) | |
| 515 | + * @since 2.0.0 bbPress (r2876) | |
| 515 | 516 | * |
| 516 | 517 | * @param int $forum_id Optional. Forum id |
| 517 | 518 | * @return string Forum last update date/time (freshness) |
| 518 | 519 | */ |
| @@ -519,8 +520,18 @@ | ||
| 519 | 520 | function bbp_get_forum_last_active_time( $forum_id = 0 ) { |
| 520 | 521 | |
| 521 | 522 | // Verify forum and get last active meta |
| 522 | 523 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 524 | + $active_id = bbp_get_forum_last_active_id( $forum_id ); | |
| 525 | + if ( empty( $active_id ) ) { | |
| 526 | + $active_id = bbp_get_forum_last_reply_id( $forum_id ); | |
| 527 | + } | |
| 528 | + if ( empty( $active_id ) ) { | |
| 529 | + $active_id = bbp_get_forum_last_topic_id( $forum_id ); | |
| 530 | + } | |
| 531 | + if ( ! empty( $active_id ) && ! bbp_is_forum_activity_public( $active_id ) ) { | |
| 532 | + return apply_filters( 'bbp_get_forum_last_active', '', $forum_id ); | |
| 533 | + } | |
| 523 | 534 | $last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true ); |
| 524 | 535 | |
| 525 | 536 | if ( empty( $last_active ) ) { |
| 526 | 537 | $reply_id = bbp_get_forum_last_reply_id( $forum_id ); |
| @@ -544,9 +555,9 @@ | ||
| 544 | 555 | * Output link to the most recent activity inside a forum. |
| 545 | 556 | * |
| 546 | 557 | * Outputs a complete link with attributes and content. |
| 547 | 558 | * |
| 548 | - * @since 2.0.0 bbPress (r2625) | |
| 559 | + * @since 2.0.0 bbPress (r2627) | |
| 549 | 560 | * |
| 550 | 561 | * @param int $forum_id Optional. Forum id |
| 551 | 562 | */ |
| 552 | 563 | function bbp_forum_freshness_link( $forum_id = 0 ) { |
| @@ -551,14 +562,40 @@ | ||
| 551 | 562 | */ |
| 552 | 563 | function bbp_forum_freshness_link( $forum_id = 0 ) { |
| 553 | 564 | echo bbp_get_forum_freshness_link( $forum_id ); |
| 554 | 565 | } |
| 566 | + | |
| 567 | +/** | |
| 568 | + * Is a topic or reply eligible for public forum activity? | |
| 569 | + * | |
| 570 | + * @since 2.6.19 bbPress (r7630) | |
| 571 | + * | |
| 572 | + * @param int $post_id Topic or reply ID. | |
| 573 | + * @return bool Whether the activity is public. | |
| 574 | + */ | |
| 575 | +function bbp_is_forum_activity_public( $post_id = 0 ) { | |
| 576 | + $post_id = (int) $post_id; | |
| 577 | + if ( empty( $post_id ) ) { | |
| 578 | + return false; | |
| 579 | + } | |
| 580 | + | |
| 581 | + if ( bbp_is_topic( $post_id ) ) { | |
| 582 | + return bbp_is_topic_public( $post_id ); | |
| 583 | + } | |
| 584 | + | |
| 585 | + if ( bbp_is_reply( $post_id ) ) { | |
| 586 | + return bbp_is_reply_public( $post_id ) && bbp_is_topic_public( bbp_get_reply_topic_id( $post_id ) ); | |
| 587 | + } | |
| 588 | + | |
| 589 | + return false; | |
| 590 | +} | |
| 591 | + | |
| 555 | 592 | /** |
| 556 | 593 | * Returns link to the most recent activity inside a forum. |
| 557 | 594 | * |
| 558 | 595 | * Returns a complete link with attributes and content. |
| 559 | 596 | * |
| 560 | - * @since 2.0.0 bbPress (r2625) | |
| 597 | + * @since 2.0.0 bbPress (r2627) | |
| 561 | 598 | * |
| 562 | 599 | * @param int $forum_id Optional. Forum id |
| 563 | 600 | */ |
| 564 | 601 | function bbp_get_forum_freshness_link( $forum_id = 0 ) { |
| @@ -573,8 +610,13 @@ | ||
| 573 | 610 | if ( empty( $active_id ) ) { |
| 574 | 611 | $active_id = bbp_get_forum_last_topic_id( $forum_id ); |
| 575 | 612 | } |
| 576 | 613 | |
| 614 | + // Existing forum metadata may still point to non-public content | |
| 615 | + if ( ! empty( $active_id ) && ! bbp_is_forum_activity_public( $active_id ) ) { | |
| 616 | + return apply_filters( 'bbp_get_forum_freshness_link', '-', $forum_id, '', '', '', $active_id ); | |
| 617 | + } | |
| 618 | + | |
| 577 | 619 | if ( bbp_is_topic( $active_id ) ) { |
| 578 | 620 | $link_url = bbp_get_forum_last_topic_permalink( $forum_id ); |
| 579 | 621 | $title = bbp_get_forum_last_topic_title( $forum_id ); |
| 580 | 622 | } elseif ( bbp_is_reply( $active_id ) ) { |
| @@ -596,9 +638,9 @@ | ||
| 596 | 638 | |
| 597 | 639 | /** |
| 598 | 640 | * Output parent ID of a forum, if exists |
| 599 | 641 | * |
| 600 | - * @since 2.1.0 bbPress (r3675) | |
| 642 | + * @since 2.1.0 bbPress (r3678) | |
| 601 | 643 | * |
| 602 | 644 | * @param int $forum_id Forum ID |
| 603 | 645 | */ |
| 604 | 646 | function bbp_forum_parent_id( $forum_id = 0 ) { |
| @@ -606,9 +648,9 @@ | ||
| 606 | 648 | } |
| 607 | 649 | /** |
| 608 | 650 | * Return ID of forum parent, if exists |
| 609 | 651 | * |
| 610 | - * @since 2.1.0 bbPress (r3675) | |
| 652 | + * @since 2.1.0 bbPress (r3678) | |
| 611 | 653 | * |
| 612 | 654 | * @param int $forum_id Optional. Forum id |
| 613 | 655 | * @return int Forum parent |
| 614 | 656 | */ |
| @@ -632,9 +674,9 @@ | ||
| 632 | 674 | |
| 633 | 675 | /** |
| 634 | 676 | * Return array of parent forums |
| 635 | 677 | * |
| 636 | - * @since 2.0.0 bbPress (r2625) | |
| 678 | + * @since 2.0.0 bbPress (r2627) | |
| 637 | 679 | * |
| 638 | 680 | * @param int $forum_id Optional. Forum id |
| 639 | 681 | * @return array Forum ancestors |
| 640 | 682 | */ |
| @@ -656,9 +698,9 @@ | ||
| 656 | 698 | |
| 657 | 699 | /** |
| 658 | 700 | * Return subforums of given forum |
| 659 | 701 | * |
| 660 | - * @since 2.0.0 bbPress (r2747) | |
| 702 | + * @since 2.0.0 bbPress (r2914) | |
| 661 | 703 | * |
| 662 | 704 | * @param array $args All the arguments supported by {@link WP_Query} |
| 663 | 705 | * @return mixed false if none, array of subs if yes |
| 664 | 706 | */ |
| @@ -817,9 +859,9 @@ | ||
| 817 | 859 | /** |
| 818 | 860 | * Output the forum subscription link |
| 819 | 861 | * |
| 820 | 862 | * @since 2.5.0 bbPress (r5156) |
| 821 | - * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support | |
| 863 | + * @since 2.6.0 bbPress (r6307) Add 'redirect_to' support | |
| 822 | 864 | */ |
| 823 | 865 | function bbp_forum_subscription_link( $args = array() ) { |
| 824 | 866 | echo bbp_get_forum_subscription_link( $args ); |
| 825 | 867 | } |
| @@ -829,9 +871,9 @@ | ||
| 829 | 871 | * |
| 830 | 872 | * A custom wrapper for bbp_get_user_subscribe_link() |
| 831 | 873 | * |
| 832 | 874 | * @since 2.5.0 bbPress (r5156) |
| 833 | - * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support | |
| 875 | + * @since 2.6.0 bbPress (r6307) Add 'redirect_to' support | |
| 834 | 876 | */ |
| 835 | 877 | function bbp_get_forum_subscription_link( $args = array() ) { |
| 836 | 878 | |
| 837 | 879 | // Defaults |
| @@ -870,9 +912,9 @@ | ||
| 870 | 912 | |
| 871 | 913 | /** |
| 872 | 914 | * Output the forum's last topic id |
| 873 | 915 | * |
| 874 | - * @since 2.0.0 bbPress (r2464) | |
| 916 | + * @since 2.0.0 bbPress (r2627) | |
| 875 | 917 | * |
| 876 | 918 | * @param int $forum_id Optional. Forum id |
| 877 | 919 | */ |
| 878 | 920 | function bbp_forum_last_topic_id( $forum_id = 0 ) { |
| @@ -880,9 +922,9 @@ | ||
| 880 | 922 | } |
| 881 | 923 | /** |
| 882 | 924 | * Return the forum's last topic id |
| 883 | 925 | * |
| 884 | - * @since 2.0.0 bbPress (r2464) | |
| 926 | + * @since 2.0.0 bbPress (r2627) | |
| 885 | 927 | * |
| 886 | 928 | * @param int $forum_id Optional. Forum id |
| 887 | 929 | * @return int Forum's last topic id |
| 888 | 930 | */ |
| @@ -896,9 +938,9 @@ | ||
| 896 | 938 | |
| 897 | 939 | /** |
| 898 | 940 | * Output the title of the last topic inside a forum |
| 899 | 941 | * |
| 900 | - * @since 2.0.0 bbPress (r2625) | |
| 942 | + * @since 2.0.0 bbPress (r2627) | |
| 901 | 943 | * |
| 902 | 944 | * @param int $forum_id Optional. Forum id |
| 903 | 945 | */ |
| 904 | 946 | function bbp_forum_last_topic_title( $forum_id = 0 ) { |
| @@ -906,9 +948,9 @@ | ||
| 906 | 948 | } |
| 907 | 949 | /** |
| 908 | 950 | * Return the title of the last topic inside a forum |
| 909 | 951 | * |
| 910 | - * @since 2.0.0 bbPress (r2625) | |
| 952 | + * @since 2.0.0 bbPress (r2627) | |
| 911 | 953 | * |
| 912 | 954 | * @param int $forum_id Optional. Forum id |
| 913 | 955 | * @return string Forum's last topic's title |
| 914 | 956 | */ |
| @@ -923,9 +965,9 @@ | ||
| 923 | 965 | |
| 924 | 966 | /** |
| 925 | 967 | * Output the link to the last topic in a forum |
| 926 | 968 | * |
| 927 | - * @since 2.0.0 bbPress (r2464) | |
| 969 | + * @since 2.0.0 bbPress (r2627) | |
| 928 | 970 | * |
| 929 | 971 | * @param int $forum_id Optional. Forum id |
| 930 | 972 | */ |
| 931 | 973 | function bbp_forum_last_topic_permalink( $forum_id = 0 ) { |
| @@ -933,9 +975,9 @@ | ||
| 933 | 975 | } |
| 934 | 976 | /** |
| 935 | 977 | * Return the link to the last topic in a forum |
| 936 | 978 | * |
| 937 | - * @since 2.0.0 bbPress (r2464) | |
| 979 | + * @since 2.0.0 bbPress (r2627) | |
| 938 | 980 | * |
| 939 | 981 | * @param int $forum_id Optional. Forum id |
| 940 | 982 | * @return string Permanent link to topic |
| 941 | 983 | */ |
| @@ -950,9 +992,9 @@ | ||
| 950 | 992 | |
| 951 | 993 | /** |
| 952 | 994 | * Return the author ID of the last topic of a forum |
| 953 | 995 | * |
| 954 | - * @since 2.0.0 bbPress (r2625) | |
| 996 | + * @since 2.0.0 bbPress (r2627) | |
| 955 | 997 | * |
| 956 | 998 | * @param int $forum_id Optional. Forum id |
| 957 | 999 | * @return int Forum's last topic's author id |
| 958 | 1000 | */ |
| @@ -967,9 +1009,9 @@ | ||
| 967 | 1009 | |
| 968 | 1010 | /** |
| 969 | 1011 | * Output link to author of last topic of forum |
| 970 | 1012 | * |
| 971 | - * @since 2.0.0 bbPress (r2625) | |
| 1013 | + * @since 2.0.0 bbPress (r2627) | |
| 972 | 1014 | * |
| 973 | 1015 | * @param int $forum_id Optional. Forum id |
| 974 | 1016 | */ |
| 975 | 1017 | function bbp_forum_last_topic_author_link( $forum_id = 0 ) { |
| @@ -977,9 +1019,9 @@ | ||
| 977 | 1019 | } |
| 978 | 1020 | /** |
| 979 | 1021 | * Return link to author of last topic of forum |
| 980 | 1022 | * |
| 981 | - * @since 2.0.0 bbPress (r2625) | |
| 1023 | + * @since 2.0.0 bbPress (r2627) | |
| 982 | 1024 | * |
| 983 | 1025 | * @param int $forum_id Optional. Forum id |
| 984 | 1026 | * @return string Forum's last topic's author link |
| 985 | 1027 | */ |
| @@ -996,9 +1038,9 @@ | ||
| 996 | 1038 | |
| 997 | 1039 | /** |
| 998 | 1040 | * Output the forums last reply id |
| 999 | 1041 | * |
| 1000 | - * @since 2.0.0 bbPress (r2464) | |
| 1042 | + * @since 2.0.0 bbPress (r2627) | |
| 1001 | 1043 | * |
| 1002 | 1044 | * @param int $forum_id Optional. Forum id |
| 1003 | 1045 | */ |
| 1004 | 1046 | function bbp_forum_last_reply_id( $forum_id = 0 ) { |
| @@ -1006,9 +1048,9 @@ | ||
| 1006 | 1048 | } |
| 1007 | 1049 | /** |
| 1008 | 1050 | * Return the forums last reply id |
| 1009 | 1051 | * |
| 1010 | - * @since 2.0.0 bbPress (r2464) | |
| 1052 | + * @since 2.0.0 bbPress (r2627) | |
| 1011 | 1053 | * |
| 1012 | 1054 | * @param int $forum_id Optional. Forum id |
| 1013 | 1055 | * @return int Forum's last reply id |
| 1014 | 1056 | */ |
| @@ -1045,9 +1087,9 @@ | ||
| 1045 | 1087 | |
| 1046 | 1088 | /** |
| 1047 | 1089 | * Output the link to the last reply in a forum |
| 1048 | 1090 | * |
| 1049 | - * @since 2.0.0 bbPress (r2464) | |
| 1091 | + * @since 2.0.0 bbPress (r2627) | |
| 1050 | 1092 | * |
| 1051 | 1093 | * @param int $forum_id Optional. Forum id |
| 1052 | 1094 | */ |
| 1053 | 1095 | function bbp_forum_last_reply_permalink( $forum_id = 0 ) { |
| @@ -1055,9 +1097,9 @@ | ||
| 1055 | 1097 | } |
| 1056 | 1098 | /** |
| 1057 | 1099 | * Return the link to the last reply in a forum |
| 1058 | 1100 | * |
| 1059 | - * @since 2.0.0 bbPress (r2464) | |
| 1101 | + * @since 2.0.0 bbPress (r2627) | |
| 1060 | 1102 | * |
| 1061 | 1103 | * @param int $forum_id Optional. Forum id |
| 1062 | 1104 | * |
| 1063 | 1105 | * @return string Permanent link to the forum's last reply |
| @@ -1073,9 +1115,9 @@ | ||
| 1073 | 1115 | |
| 1074 | 1116 | /** |
| 1075 | 1117 | * Output the url to the last reply in a forum |
| 1076 | 1118 | * |
| 1077 | - * @since 2.0.0 bbPress (r2683) | |
| 1119 | + * @since 2.0.0 bbPress (r2684) | |
| 1078 | 1120 | * |
| 1079 | 1121 | * @param int $forum_id Optional. Forum id |
| 1080 | 1122 | */ |
| 1081 | 1123 | function bbp_forum_last_reply_url( $forum_id = 0 ) { |
| @@ -1083,9 +1125,9 @@ | ||
| 1083 | 1125 | } |
| 1084 | 1126 | /** |
| 1085 | 1127 | * Return the url to the last reply in a forum |
| 1086 | 1128 | * |
| 1087 | - * @since 2.0.0 bbPress (r2683) | |
| 1129 | + * @since 2.0.0 bbPress (r2684) | |
| 1088 | 1130 | * |
| 1089 | 1131 | * @param int $forum_id Optional. Forum id |
| 1090 | 1132 | * @return string Paginated URL to latest reply |
| 1091 | 1133 | */ |
| @@ -1113,9 +1155,9 @@ | ||
| 1113 | 1155 | |
| 1114 | 1156 | /** |
| 1115 | 1157 | * Output author ID of last reply of forum |
| 1116 | 1158 | * |
| 1117 | - * @since 2.0.0 bbPress (r2625) | |
| 1159 | + * @since 2.0.0 bbPress (r2627) | |
| 1118 | 1160 | * |
| 1119 | 1161 | * @param int $forum_id Optional. Forum id |
| 1120 | 1162 | */ |
| 1121 | 1163 | function bbp_forum_last_reply_author_id( $forum_id = 0 ) { |
| @@ -1123,9 +1165,9 @@ | ||
| 1123 | 1165 | } |
| 1124 | 1166 | /** |
| 1125 | 1167 | * Return author ID of last reply of forum |
| 1126 | 1168 | * |
| 1127 | - * @since 2.0.0 bbPress (r2625) | |
| 1169 | + * @since 2.0.0 bbPress (r2627) | |
| 1128 | 1170 | * |
| 1129 | 1171 | * @param int $forum_id Optional. Forum id |
| 1130 | 1172 | * @return int Forum's last reply author id |
| 1131 | 1173 | */ |
| @@ -1140,9 +1182,9 @@ | ||
| 1140 | 1182 | |
| 1141 | 1183 | /** |
| 1142 | 1184 | * Output link to author of last reply of forum |
| 1143 | 1185 | * |
| 1144 | - * @since 2.0.0 bbPress (r2625) | |
| 1186 | + * @since 2.0.0 bbPress (r2627) | |
| 1145 | 1187 | * |
| 1146 | 1188 | * @param int $forum_id Optional. Forum id |
| 1147 | 1189 | */ |
| 1148 | 1190 | function bbp_forum_last_reply_author_link( $forum_id = 0 ) { |
| @@ -1150,9 +1192,9 @@ | ||
| 1150 | 1192 | } |
| 1151 | 1193 | /** |
| 1152 | 1194 | * Return link to author of last reply of forum |
| 1153 | 1195 | * |
| 1154 | - * @since 2.0.0 bbPress (r2625) | |
| 1196 | + * @since 2.0.0 bbPress (r2627) | |
| 1155 | 1197 | * |
| 1156 | 1198 | * @param int $forum_id Optional. Forum id |
| 1157 | 1199 | * @return string Link to author of last reply of forum |
| 1158 | 1200 | */ |
| @@ -1169,9 +1211,9 @@ | ||
| 1169 | 1211 | |
| 1170 | 1212 | /** |
| 1171 | 1213 | * Output the topics link of the forum |
| 1172 | 1214 | * |
| 1173 | - * @since 2.0.0 bbPress (r2883) | |
| 1215 | + * @since 2.0.0 bbPress (r2889) | |
| 1174 | 1216 | * |
| 1175 | 1217 | * @param int $forum_id Optional. Topic id |
| 1176 | 1218 | */ |
| 1177 | 1219 | function bbp_forum_topics_link( $forum_id = 0 ) { |
| @@ -1180,9 +1222,9 @@ | ||
| 1180 | 1222 | |
| 1181 | 1223 | /** |
| 1182 | 1224 | * Return the topics link of the forum |
| 1183 | 1225 | * |
| 1184 | - * @since 2.0.0 bbPress (r2883) | |
| 1226 | + * @since 2.0.0 bbPress (r2889) | |
| 1185 | 1227 | * |
| 1186 | 1228 | * @param int $forum_id Optional. Topic id |
| 1187 | 1229 | */ |
| 1188 | 1230 | function bbp_get_forum_topics_link( $forum_id = 0 ) { |
| @@ -1219,9 +1261,9 @@ | ||
| 1219 | 1261 | |
| 1220 | 1262 | /** |
| 1221 | 1263 | * Output total sub-forum count of a forum |
| 1222 | 1264 | * |
| 1223 | - * @since 2.0.0 bbPress (r2464) | |
| 1265 | + * @since 2.0.0 bbPress (r2627) | |
| 1224 | 1266 | * |
| 1225 | 1267 | * @param int $forum_id Optional. Forum id to check |
| 1226 | 1268 | * @param boolean $integer Optional. Whether or not to format the result |
| 1227 | 1269 | */ |
| @@ -1230,9 +1272,9 @@ | ||
| 1230 | 1272 | } |
| 1231 | 1273 | /** |
| 1232 | 1274 | * Return total subforum count of a forum |
| 1233 | 1275 | * |
| 1234 | - * @since 2.0.0 bbPress (r2464) | |
| 1276 | + * @since 2.0.0 bbPress (r2627) | |
| 1235 | 1277 | * |
| 1236 | 1278 | * @param int $forum_id Optional. Forum id |
| 1237 | 1279 | * @param boolean $integer Optional. Whether or not to format the result |
| 1238 | 1280 | * @return int Forum's subforum count |
| @@ -1283,9 +1325,9 @@ | ||
| 1283 | 1325 | |
| 1284 | 1326 | /** |
| 1285 | 1327 | * Output total reply count of a forum |
| 1286 | 1328 | * |
| 1287 | - * @since 2.0.0 bbPress (r2464) | |
| 1329 | + * @since 2.0.0 bbPress (r2615) | |
| 1288 | 1330 | * |
| 1289 | 1331 | * @param int $forum_id Optional. Forum id |
| 1290 | 1332 | * @param bool $total_count Optional. To get the total count or normal count? |
| 1291 | 1333 | * @param boolean $integer Optional. Whether or not to format the result |
| @@ -1295,9 +1337,9 @@ | ||
| 1295 | 1337 | } |
| 1296 | 1338 | /** |
| 1297 | 1339 | * Return total post count of a forum |
| 1298 | 1340 | * |
| 1299 | - * @since 2.0.0 bbPress (r2464) | |
| 1341 | + * @since 2.0.0 bbPress (r2615) | |
| 1300 | 1342 | * |
| 1301 | 1343 | * @param int $forum_id Optional. Forum id |
| 1302 | 1344 | * @param bool $total_count Optional. To get the total count or normal |
| 1303 | 1345 | * count? |
| @@ -1317,9 +1359,9 @@ | ||
| 1317 | 1359 | |
| 1318 | 1360 | /** |
| 1319 | 1361 | * Output total post count of a forum |
| 1320 | 1362 | * |
| 1321 | - * @since 2.0.0 bbPress (r2954) | |
| 1363 | + * @since 2.0.0 bbPress (r2464) | |
| 1322 | 1364 | * |
| 1323 | 1365 | * @param int $forum_id Optional. Forum id |
| 1324 | 1366 | * @param bool $total_count Optional. To get the total count or normal count? |
| 1325 | 1367 | * @param boolean $integer Optional. Whether or not to format the result |
| @@ -1329,9 +1371,9 @@ | ||
| 1329 | 1371 | } |
| 1330 | 1372 | /** |
| 1331 | 1373 | * Return total post count of a forum |
| 1332 | 1374 | * |
| 1333 | - * @since 2.0.0 bbPress (r2954) | |
| 1375 | + * @since 2.0.0 bbPress (r2464) | |
| 1334 | 1376 | * |
| 1335 | 1377 | * @param int $forum_id Optional. Forum id |
| 1336 | 1378 | * @param bool $total_count Optional. To get the total count or normal |
| 1337 | 1379 | * count? |
| @@ -1353,9 +1395,9 @@ | ||
| 1353 | 1395 | /** |
| 1354 | 1396 | * Output total hidden topic count of a forum (hidden includes trashed, spammed, |
| 1355 | 1397 | * and pending topics) |
| 1356 | 1398 | * |
| 1357 | - * @since 2.0.0 bbPress (r2883) | |
| 1399 | + * @since 2.0.0 bbPress (r3349) | |
| 1358 | 1400 | * @since 2.6.0 bbPress (r6922) Changed function signature to add total counts |
| 1359 | 1401 | * |
| 1360 | 1402 | * @param int $forum_id Optional. Forum id |
| 1361 | 1403 | * @param bool $total_count Optional. To get the total count or normal count? |
| @@ -1367,9 +1409,9 @@ | ||
| 1367 | 1409 | /** |
| 1368 | 1410 | * Return total hidden topic count of a forum (hidden includes trashed, |
| 1369 | 1411 | * spammed and pending topics) |
| 1370 | 1412 | * |
| 1371 | - * @since 2.0.0 bbPress (r2883) | |
| 1413 | + * @since 2.0.0 bbPress (r3349) | |
| 1372 | 1414 | * @since 2.6.0 bbPress (r6922) Changed function signature to add total counts |
| 1373 | 1415 | * |
| 1374 | 1416 | * @param int $forum_id Optional. Forum id |
| 1375 | 1417 | * @param bool $total_count Optional. To get the total count or normal count? |
| @@ -1390,9 +1432,9 @@ | ||
| 1390 | 1432 | /** |
| 1391 | 1433 | * Output total hidden reply count of a forum (hidden includes trashed, spammed, |
| 1392 | 1434 | * and pending replies) |
| 1393 | 1435 | * |
| 1394 | - * @since 2.6.0 bbPress (r6922) | |
| 1436 | + * @since 2.6.0 bbPress (r6923) | |
| 1395 | 1437 | * |
| 1396 | 1438 | * @param int $forum_id Optional. Forum id |
| 1397 | 1439 | * @param bool $total_count Optional. To get the total count or normal count? |
| 1398 | 1440 | * @param boolean $integer Optional. Whether or not to format the result |
| @@ -1403,9 +1445,9 @@ | ||
| 1403 | 1445 | /** |
| 1404 | 1446 | * Return total hidden reply count of a forum (hidden includes trashed, |
| 1405 | 1447 | * spammed and pending replies) |
| 1406 | 1448 | * |
| 1407 | - * @since 2.6.0 bbPress (r6922) | |
| 1449 | + * @since 2.6.0 bbPress (r6923) | |
| 1408 | 1450 | * |
| 1409 | 1451 | * @param int $forum_id Optional. Forum id |
| 1410 | 1452 | * @param bool $total_count Optional. To get the total count or normal |
| 1411 | 1453 | * count? |
| @@ -1425,9 +1467,9 @@ | ||
| 1425 | 1467 | |
| 1426 | 1468 | /** |
| 1427 | 1469 | * Output the status of the forum |
| 1428 | 1470 | * |
| 1429 | - * @since 2.0.0 bbPress (r2667) | |
| 1471 | + * @since 2.0.0 bbPress (r2678) | |
| 1430 | 1472 | * |
| 1431 | 1473 | * @param int $forum_id Optional. Forum id |
| 1432 | 1474 | */ |
| 1433 | 1475 | function bbp_forum_status( $forum_id = 0 ) { |
| @@ -1435,9 +1477,9 @@ | ||
| 1435 | 1477 | } |
| 1436 | 1478 | /** |
| 1437 | 1479 | * Return the status of the forum |
| 1438 | 1480 | * |
| 1439 | - * @since 2.0.0 bbPress (r2667) | |
| 1481 | + * @since 2.0.0 bbPress (r2678) | |
| 1440 | 1482 | * |
| 1441 | 1483 | * @param int $forum_id Optional. Forum id |
| 1442 | 1484 | * @return string Status of forum |
| 1443 | 1485 | */ |
| @@ -1455,9 +1497,9 @@ | ||
| 1455 | 1497 | |
| 1456 | 1498 | /** |
| 1457 | 1499 | * Output the visibility of the forum |
| 1458 | 1500 | * |
| 1459 | - * @since 2.0.0 bbPress (r2997) | |
| 1501 | + * @since 2.0.0 bbPress (r2998) | |
| 1460 | 1502 | * |
| 1461 | 1503 | * @param int $forum_id Optional. Forum id |
| 1462 | 1504 | */ |
| 1463 | 1505 | function bbp_forum_visibility( $forum_id = 0 ) { |
| @@ -1465,9 +1507,9 @@ | ||
| 1465 | 1507 | } |
| 1466 | 1508 | /** |
| 1467 | 1509 | * Return the visibility of the forum |
| 1468 | 1510 | * |
| 1469 | - * @since 2.0.0 bbPress (r2997) | |
| 1511 | + * @since 2.0.0 bbPress (r2998) | |
| 1470 | 1512 | * |
| 1471 | 1513 | * @param int $forum_id Optional. Forum id |
| 1472 | 1514 | * @return string Status of forum |
| 1473 | 1515 | */ |
| @@ -1634,9 +1676,9 @@ | ||
| 1634 | 1676 | |
| 1635 | 1677 | /** |
| 1636 | 1678 | * Is the forum public? |
| 1637 | 1679 | * |
| 1638 | - * @since 2.0.0 bbPress (r2997) | |
| 1680 | + * @since 2.0.0 bbPress (r2998) | |
| 1639 | 1681 | * |
| 1640 | 1682 | * @param int $forum_id Optional. Forum id |
| 1641 | 1683 | * @param bool $check_ancestors Check if the ancestors are public |
| 1642 | 1684 | * @return bool True if closed, false if not |
| @@ -1676,9 +1718,9 @@ | ||
| 1676 | 1718 | |
| 1677 | 1719 | /** |
| 1678 | 1720 | * Is the forum hidden? |
| 1679 | 1721 | * |
| 1680 | - * @since 2.0.0 bbPress (r2997) | |
| 1722 | + * @since 2.0.0 bbPress (r2998) | |
| 1681 | 1723 | * |
| 1682 | 1724 | * @param int $forum_id Optional. Forum id |
| 1683 | 1725 | * @param bool $check_ancestors Check if the ancestors are private (only if |
| 1684 | 1726 | * they're a category) |
| @@ -1698,9 +1740,9 @@ | ||
| 1698 | 1740 | |
| 1699 | 1741 | /** |
| 1700 | 1742 | * Is the forum private or hidden? |
| 1701 | 1743 | * |
| 1702 | - * @since 2.6.17 | |
| 1744 | + * @since 2.6.17 bbPress (r7474) | |
| 1703 | 1745 | * |
| 1704 | 1746 | * @param int $forum_id Optional. Forum id. |
| 1705 | 1747 | * @param bool $check_ancestors Whether to check the forum ancestors. |
| 1706 | 1748 | * @return bool True if private or hidden, false if not. |
| @@ -1718,9 +1760,9 @@ | ||
| 1718 | 1760 | * |
| 1719 | 1761 | * Checks the forum and its ancestors for private or hidden visibility, and |
| 1720 | 1762 | * whether the user is a forum moderator or can otherwise read the forum. |
| 1721 | 1763 | * |
| 1722 | - * @since 2.6.17 | |
| 1764 | + * @since 2.6.17 bbPress (r7504) | |
| 1723 | 1765 | * |
| 1724 | 1766 | * @param int $forum_id Optional. Forum ID. |
| 1725 | 1767 | * @param int $user_id Optional. User ID. Defaults to 0. |
| 1726 | 1768 | * @return bool True if the forum is restricted from the user, false if not. |
| @@ -1793,12 +1835,17 @@ | ||
| 1793 | 1835 | // Check if the forum is not a category |
| 1794 | 1836 | if ( bbp_is_forum( $ancestor ) ) { |
| 1795 | 1837 | |
| 1796 | 1838 | // Check the forum visibility |
| 1797 | - $retval = bbp_is_forum_visibility( $ancestor, $status_name, false ); | |
| 1798 | - if ( true === $retval ) { | |
| 1839 | + $ancestor_matches = bbp_is_forum_visibility( $ancestor, $status_name, false ); | |
| 1840 | + if ( true === $ancestor_matches ) { | |
| 1799 | 1841 | ++$count; |
| 1800 | 1842 | } |
| 1843 | + | |
| 1844 | + // Combine visibility across the whole forum hierarchy. | |
| 1845 | + $retval = ( 'OR' === $operator ) | |
| 1846 | + ? ( $retval || $ancestor_matches ) | |
| 1847 | + : ( $retval && $ancestor_matches ); | |
| 1801 | 1848 | } |
| 1802 | 1849 | |
| 1803 | 1850 | // Break when it reach the max count |
| 1804 | 1851 | if ( ( 'OR' === $operator ) && ( $count >= 1 ) ) { |
| @@ -1814,9 +1861,9 @@ | ||
| 1814 | 1861 | |
| 1815 | 1862 | /** |
| 1816 | 1863 | * Output the author ID of the forum |
| 1817 | 1864 | * |
| 1818 | - * @since 2.1.0 bbPress (r3675) | |
| 1865 | + * @since 2.1.0 bbPress (r3678) | |
| 1819 | 1866 | * |
| 1820 | 1867 | * @param int $forum_id Optional. Forum id |
| 1821 | 1868 | */ |
| 1822 | 1869 | function bbp_forum_author_id( $forum_id = 0 ) { |
| @@ -1824,9 +1871,9 @@ | ||
| 1824 | 1871 | } |
| 1825 | 1872 | /** |
| 1826 | 1873 | * Return the author ID of the forum |
| 1827 | 1874 | * |
| 1828 | - * @since 2.1.0 bbPress (r3675) | |
| 1875 | + * @since 2.1.0 bbPress (r3678) | |
| 1829 | 1876 | * |
| 1830 | 1877 | * @param int $forum_id Optional. Forum id |
| 1831 | 1878 | * |
| 1832 | 1879 | * @return string Author of forum |
| @@ -1841,9 +1888,9 @@ | ||
| 1841 | 1888 | |
| 1842 | 1889 | /** |
| 1843 | 1890 | * Output the author of the forum |
| 1844 | 1891 | * |
| 1845 | - * @since 2.1.0 bbPress (r3675) | |
| 1892 | + * @since 2.1.0 bbPress (r3678) | |
| 1846 | 1893 | * |
| 1847 | 1894 | * @param int $forum_id Optional. Forum id |
| 1848 | 1895 | */ |
| 1849 | 1896 | function bbp_forum_author_display_name( $forum_id = 0 ) { |
| @@ -1851,9 +1898,9 @@ | ||
| 1851 | 1898 | } |
| 1852 | 1899 | /** |
| 1853 | 1900 | * Return the author of the forum |
| 1854 | 1901 | * |
| 1855 | - * @since 2.1.0 bbPress (r3675) | |
| 1902 | + * @since 2.1.0 bbPress (r3678) | |
| 1856 | 1903 | * |
| 1857 | 1904 | * @param int $forum_id Optional. Forum id |
| 1858 | 1905 | * @return string Author of forum |
| 1859 | 1906 | */ |
| @@ -1873,9 +1920,9 @@ | ||
| 1873 | 1920 | * private or hidden forum remains restricted to users who can read the |
| 1874 | 1921 | * restricting ancestor. Aggregate metadata must therefore be checked against |
| 1875 | 1922 | * the forum that supplied it, rather than only the forum where it is rendered. |
| 1876 | 1923 | * |
| 1877 | - * @since 2.0.0 bbPress (r3162) | |
| 1924 | + * @since 2.0.0 bbPress (r3008) | |
| 1878 | 1925 | * |
| 1879 | 1926 | * @param string $retval |
| 1880 | 1927 | * @param int $forum_id |
| 1881 | 1928 | * @param string $time_since |
| @@ -1907,39 +1954,48 @@ | ||
| 1907 | 1954 | |
| 1908 | 1955 | /** |
| 1909 | 1956 | * Replace forum author details for users that cannot view them. |
| 1910 | 1957 | * |
| 1911 | - * @since 2.0.0 bbPress (r3162) | |
| 1958 | + * @since 2.0.0 bbPress (r3008) | |
| 1912 | 1959 | * |
| 1913 | 1960 | * @param string $author_link |
| 1914 | 1961 | * @param array $args |
| 1962 | + * @param array|int $original_args Original author-link arguments. | |
| 1915 | 1963 | * |
| 1916 | 1964 | * @return string |
| 1917 | 1965 | */ |
| 1918 | -function bbp_suppress_private_author_link( $author_link = '', $args = array() ) { | |
| 1966 | +function bbp_suppress_private_author_link( $author_link = '', $args = array(), $original_args = array() ) { | |
| 1919 | 1967 | |
| 1920 | 1968 | // Assume the author link is the return value |
| 1921 | 1969 | $retval = $author_link; |
| 1970 | + $post_id = ! empty( $args['post_id'] ) | |
| 1971 | + ? (int) $args['post_id'] | |
| 1972 | + : ( is_numeric( $original_args ) ? (int) $original_args : 0 ); | |
| 1922 | 1973 | |
| 1974 | + // Suppress non-public authors unless this user moderates their forum | |
| 1975 | + if ( ! empty( $post_id ) && ( bbp_is_topic( $post_id ) || bbp_is_reply( $post_id ) ) && ! bbp_is_forum_activity_public( $post_id ) && ! current_user_can( 'moderate', $post_id ) ) { | |
| 1976 | + $retval = '-'; | |
| 1977 | + } | |
| 1978 | + | |
| 1923 | 1979 | // Show the normal author link |
| 1924 | - if ( ! empty( $args['post_id'] ) ) { | |
| 1980 | + if ( ! empty( $post_id ) ) { | |
| 1925 | 1981 | |
| 1926 | 1982 | // What post type are we looking at? |
| 1927 | - switch ( get_post_type( $args['post_id'] ) ) { | |
| 1983 | + switch ( get_post_type( $post_id ) ) { | |
| 1928 | 1984 | |
| 1929 | 1985 | // Topic |
| 1930 | 1986 | case bbp_get_topic_post_type() : |
| 1931 | - $forum_id = bbp_get_topic_forum_id( $args['post_id'] ); | |
| 1987 | + $forum_id = bbp_get_topic_forum_id( $post_id ); | |
| 1932 | 1988 | break; |
| 1933 | 1989 | |
| 1934 | 1990 | // Reply |
| 1935 | 1991 | case bbp_get_reply_post_type() : |
| 1936 | - $forum_id = bbp_get_reply_forum_id( $args['post_id'] ); | |
| 1992 | + $forum_id = bbp_get_reply_forum_id( $post_id ); | |
| 1937 | 1993 | break; |
| 1938 | 1994 | |
| 1939 | 1995 | // Post |
| 1940 | 1996 | default : |
| 1941 | - $forum_id = bbp_get_forum_id( $args['post_id'] ); | |
| 1997 | + $forum_id = bbp_get_forum_id( $post_id ); | |
| 1942 | 1998 | break; |
| 1943 | 1999 | } |
| 1944 | 2000 | |
| 1945 | 2001 | // Suppress if this forum or an ancestor is restricted from the current user |
| @@ -1954,9 +2010,9 @@ | ||
| 1954 | 2010 | |
| 1955 | 2011 | /** |
| 1956 | 2012 | * Output the row class of a forum |
| 1957 | 2013 | * |
| 1958 | - * @since 2.0.0 bbPress (r2667) | |
| 2014 | + * @since 2.0.0 bbPress (r2678) | |
| 1959 | 2015 | * |
| 1960 | 2016 | * @param int $forum_id Optional. Forum ID. |
| 1961 | 2017 | * @param array Extra classes you can pass when calling this function |
| 1962 | 2018 | */ |
| @@ -1965,9 +2021,9 @@ | ||
| 1965 | 2021 | } |
| 1966 | 2022 | /** |
| 1967 | 2023 | * Return the row class of a forum |
| 1968 | 2024 | * |
| 1969 | - * @since 2.0.0 bbPress (r2667) | |
| 2025 | + * @since 2.0.0 bbPress (r2678) | |
| 1970 | 2026 | * |
| 1971 | 2027 | * @param int $forum_id Optional. Forum ID |
| 1972 | 2028 | * @param array Extra classes you can pass when calling this function |
| 1973 | 2029 | * @return string Row class of the forum |
| @@ -2037,9 +2093,9 @@ | ||
| 2037 | 2093 | /** |
| 2038 | 2094 | * Output a fancy description of the current forum, including total topics, |
| 2039 | 2095 | * total replies, and last activity. |
| 2040 | 2096 | * |
| 2041 | - * @since 2.0.0 bbPress (r2860) | |
| 2097 | + * @since 2.0.0 bbPress (r2876) | |
| 2042 | 2098 | * |
| 2043 | 2099 | * @param array $args Arguments passed to alter output |
| 2044 | 2100 | */ |
| 2045 | 2101 | function bbp_single_forum_description( $args = array() ) { |
| @@ -2048,9 +2104,9 @@ | ||
| 2048 | 2104 | /** |
| 2049 | 2105 | * Return a fancy description of the current forum, including total |
| 2050 | 2106 | * topics, total replies, and last activity. |
| 2051 | 2107 | * |
| 2052 | - * @since 2.0.0 bbPress (r2860) | |
| 2108 | + * @since 2.0.0 bbPress (r2876) | |
| 2053 | 2109 | * |
| 2054 | 2110 | * @param array $args This function supports these arguments: |
| 2055 | 2111 | * - forum_id: Forum id |
| 2056 | 2112 | * - before: Before the text |
| @@ -2084,8 +2140,11 @@ | ||
| 2084 | 2140 | $rc_int = bbp_get_forum_reply_count( $forum_id, true, true ); |
| 2085 | 2141 | $topic_count = bbp_get_forum_topic_count( $forum_id, true, false ); |
| 2086 | 2142 | $reply_count = bbp_get_forum_reply_count( $forum_id, true, false ); |
| 2087 | 2143 | $last_active = bbp_get_forum_last_active_id( $forum_id ); |
| 2144 | + if ( ! empty( $last_active ) && ! bbp_is_forum_activity_public( $last_active ) ) { | |
| 2145 | + $last_active = 0; | |
| 2146 | + } | |
| 2088 | 2147 | |
| 2089 | 2148 | // Has replies |
| 2090 | 2149 | if ( ! empty( $reply_count ) ) { |
| 2091 | 2150 | /* translators: %s: Number of replies */ |
| @@ -2232,9 +2291,9 @@ | ||
| 2232 | 2291 | |
| 2233 | 2292 | /** |
| 2234 | 2293 | * Output value of forum moderators field |
| 2235 | 2294 | * |
| 2236 | - * @since 2.6.0 bbPress (r5837) | |
| 2295 | + * @since 2.6.0 bbPress (r6056) | |
| 2237 | 2296 | */ |
| 2238 | 2297 | function bbp_form_forum_moderators() { |
| 2239 | 2298 | echo bbp_get_form_forum_moderators(); |
| 2240 | 2299 | } |
| @@ -2240,9 +2299,9 @@ | ||
| 2240 | 2299 | } |
| 2241 | 2300 | /** |
| 2242 | 2301 | * Return value of forum moderators field |
| 2243 | 2302 | * |
| 2244 | - * @since 2.6.0 bbPress (r5837) | |
| 2303 | + * @since 2.6.0 bbPress (r6056) | |
| 2245 | 2304 | * |
| 2246 | 2305 | * @return string Value of forum mods field |
| 2247 | 2306 | */ |
| 2248 | 2307 | function bbp_get_form_forum_moderators() { |