Ticket #3354: 3354.2.patch
File 3354.2.patch, 6.6 KB (added by , 5 years ago) |
---|
-
src/includes/core/abstraction.php
475 475 ? $default 476 476 : $filtered; 477 477 } 478 479 /** Date/Time *****************************************************************/ 480 481 /** 482 * Get an empty datetime value. 483 * 484 * @since 2.6.6 bbPress (r7094) 485 * 486 * @return string 487 */ 488 function bbp_get_empty_datetime() { 489 490 // Get the database version 491 $db_version = bbp_db()->db_version(); 492 493 // Default return value 494 $retval = '0000-00-00 00:00:00'; 495 496 // Filter & return 497 return (string) apply_filters( 'bbp_get_default_zero_date', $retval, $db_version ); 498 } -
src/includes/core/theme-compat.php
364 364 365 365 // Switch defaults if post is set 366 366 if ( isset( $wp_query->post ) ) { 367 $dummy = bbp_parse_args( $args, array( 367 368 // Use primarily Post attributes 369 $default = array( 368 370 'ID' => $wp_query->post->ID, 369 371 'post_status' => $wp_query->post->post_status, 370 372 'post_author' => $wp_query->post->post_author, … … 395 397 'is_single' => false, 396 398 'is_archive' => false, 397 399 'is_tax' => false 398 ) , 'theme_compat_reset_post' );400 ); 399 401 } else { 400 $dummy = bbp_parse_args( $args, array( 402 403 // Get the default zero date value a single time 404 $zero_date = bbp_get_empty_datetime(); 405 406 // Use primarily empty attributes 407 $default = array( 401 408 'ID' => -9999, 402 409 'post_status' => bbp_get_public_status_id(), 403 410 'post_author' => 0, 404 411 'post_parent' => 0, 405 412 'post_type' => 'page', 406 'post_date' => 0,407 'post_date_gmt' => 0,408 'post_modified' => 0,409 'post_modified_gmt' => 0,413 'post_date' => $zero_date, 414 'post_date_gmt' => $zero_date, 415 'post_modified' => $zero_date, 416 'post_modified_gmt' => $zero_date, 410 417 'post_content' => '', 411 418 'post_title' => '', 412 419 'post_excerpt' => '', … … 428 435 'is_single' => false, 429 436 'is_archive' => false, 430 437 'is_tax' => false 431 ) , 'theme_compat_reset_post' );438 ); 432 439 } 433 440 441 // Parse & filter 442 $dummy = bbp_parse_args( $args, $default, 'theme_compat_reset_post' ); 443 434 444 // Bail if dummy post is empty 435 445 if ( empty( $dummy ) ) { 436 446 return; … … 510 520 bbp_theme_compat_reset_post( array( 511 521 'ID' => 0, 512 522 'post_author' => 0, 513 'post_date' => 0,523 'post_date' => bbp_get_empty_datetime(), 514 524 'post_content' => bbp_buffer_template_part( 'content', 'single-user', false ), 515 525 'post_type' => '', 516 526 'post_title' => bbp_get_displayed_user_field( 'display_name' ), … … 566 576 'ID' => ! empty( $page->ID ) ? $page->ID : 0, 567 577 'post_title' => $new_title, 568 578 'post_author' => 0, 569 'post_date' => 0,579 'post_date' => bbp_get_empty_datetime(), 570 580 'post_content' => $new_content, 571 581 'post_type' => bbp_get_forum_post_type(), 572 582 'post_status' => bbp_get_public_status_id(), … … 582 592 'ID' => bbp_get_forum_id(), 583 593 'post_title' => bbp_get_forum_title(), 584 594 'post_author' => bbp_get_forum_author_id(), 585 'post_date' => 0,595 'post_date' => bbp_get_empty_datetime(), 586 596 'post_content' => $bbp_shortcodes->display_forum_form(), 587 597 'post_type' => bbp_get_forum_post_type(), 588 598 'post_status' => bbp_get_forum_visibility(), … … 600 610 'ID' => bbp_get_forum_id(), 601 611 'post_title' => bbp_get_forum_title(), 602 612 'post_author' => bbp_get_forum_author_id(), 603 'post_date' => 0,613 'post_date' => bbp_get_empty_datetime(), 604 614 'post_content' => $bbp_shortcodes->display_forum( array( 'id' => bbp_get_forum_id() ) ), 605 615 'post_type' => bbp_get_forum_post_type(), 606 616 'post_status' => bbp_get_forum_visibility(), … … 639 649 'ID' => ! empty( $page->ID ) ? $page->ID : 0, 640 650 'post_title' => bbp_get_topic_archive_title(), 641 651 'post_author' => 0, 642 'post_date' => 0,652 'post_date' => bbp_get_empty_datetime(), 643 653 'post_content' => $new_content, 644 654 'post_type' => bbp_get_topic_post_type(), 645 655 'post_status' => bbp_get_public_status_id(), … … 675 685 'ID' => bbp_get_topic_id(), 676 686 'post_title' => bbp_get_topic_title(), 677 687 'post_author' => bbp_get_topic_author_id(), 678 'post_date' => 0,688 'post_date' => bbp_get_empty_datetime(), 679 689 'post_content' => $new_content, 680 690 'post_type' => bbp_get_topic_post_type(), 681 691 'post_status' => bbp_get_topic_status(), … … 693 703 'ID' => 0, 694 704 'post_title' => esc_html__( 'Replies', 'bbpress' ), 695 705 'post_author' => 0, 696 'post_date' => 0,706 'post_date' => bbp_get_empty_datetime(), 697 707 'post_content' => $bbp_shortcodes->display_reply_index(), 698 708 'post_type' => bbp_get_reply_post_type(), 699 709 'post_status' => bbp_get_public_status_id(), … … 725 735 'ID' => bbp_get_reply_id(), 726 736 'post_title' => bbp_get_reply_title(), 727 737 'post_author' => bbp_get_reply_author_id(), 728 'post_date' => 0,738 'post_date' => bbp_get_empty_datetime(), 729 739 'post_content' => $new_content, 730 740 'post_type' => bbp_get_reply_post_type(), 731 741 'post_status' => bbp_get_reply_status(), … … 742 752 'ID' => 0, 743 753 'post_title' => bbp_get_view_title(), 744 754 'post_author' => 0, 745 'post_date' => 0,755 'post_date' => bbp_get_empty_datetime(), 746 756 'post_content' => $bbp_shortcodes->display_view( array( 'id' => get_query_var( bbp_get_view_rewrite_id() ) ) ), 747 757 'post_type' => '', 748 758 'post_status' => bbp_get_public_status_id(), … … 759 769 'ID' => 0, 760 770 'post_title' => bbp_get_search_title(), 761 771 'post_author' => 0, 762 'post_date' => 0,772 'post_date' => bbp_get_empty_datetime(), 763 773 'post_content' => $bbp_shortcodes->display_search( array( 'search' => get_query_var( bbp_get_search_rewrite_id() ) ) ), 764 774 'post_type' => '', 765 775 'post_status' => bbp_get_public_status_id(), … … 788 798 bbp_theme_compat_reset_post( array( 789 799 'ID' => 0, 790 800 'post_author' => 0, 791 'post_date' => 0,801 'post_date' => bbp_get_empty_datetime(), 792 802 'post_content' => $new_content, 793 803 'post_type' => '', 794 804 'post_title' => sprintf( esc_html__( 'Topic Tag: %s', 'bbpress' ), bbp_get_topic_tag_name() ),