diff --git src/includes/common/functions.php src/includes/common/functions.php
index f81ea776..0793126d 100644
|
|
function bbp_get_public_child_last_id( $parent_id = 0, $post_type = 'post' ) { |
1475 | 1475 | 'post_parent' => $parent_id, |
1476 | 1476 | 'post_status' => $post_status, |
1477 | 1477 | 'post_type' => $post_type, |
| 1478 | 'orderby' => array( |
| 1479 | 'post_date' => 'DESC', |
| 1480 | 'ID' => 'DESC', |
| 1481 | ), |
1478 | 1482 | |
1479 | 1483 | // Maybe change these later |
1480 | 1484 | 'posts_per_page' => 1, |
diff --git src/includes/forums/functions.php src/includes/forums/functions.php
index 642c7aac..280c5547 100644
|
|
function bbp_exclude_forum_ids( $type = 'string' ) { |
2143 | 2143 | $types['string'] = implode( ',', $forum_ids ); |
2144 | 2144 | $types['meta_query'] = array( |
2145 | 2145 | 'key' => '_bbp_forum_id', |
2146 | | 'value' => $forum_ids, |
| 2146 | 'value' => $types['string'], |
2147 | 2147 | 'type' => 'NUMERIC', |
2148 | | 'compare' => $compare |
| 2148 | 'compare' => $compare, |
2149 | 2149 | ); |
2150 | 2150 | } |
2151 | 2151 | } |
… |
… |
function bbp_forum_query_last_reply_id( $forum_id = 0, $topic_ids = 0 ) { |
2335 | 2335 | 'post_parent__in' => $topic_ids, |
2336 | 2336 | 'post_status' => bbp_get_public_status_id(), |
2337 | 2337 | 'post_type' => bbp_get_reply_post_type(), |
| 2338 | 'orderby' => array( |
| 2339 | 'post_date' => 'DESC', |
| 2340 | 'ID' => 'DESC', |
| 2341 | ), |
2338 | 2342 | |
2339 | 2343 | // Maybe change these later |
2340 | 2344 | 'posts_per_page' => 1, |
diff --git tests/phpunit/testcases/forums/template/get-last-thing.php tests/phpunit/testcases/forums/template/get-last-thing.php
index 9757cac6..11f47a13 100644
|
|
class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { |
532 | 532 | ), |
533 | 533 | ) ); |
534 | 534 | |
535 | | $this->factory->reply->create( array( |
| 535 | $r1 = $this->factory->reply->create( array( |
536 | 536 | 'post_parent' => $t, |
537 | 537 | 'reply_meta' => array( |
538 | 538 | 'forum_id' => $f, |
… |
… |
class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { |
542 | 542 | |
543 | 543 | // Get the forums last reply id. |
544 | 544 | $last_reply_id_f = bbp_get_forum_last_reply_id( $f ); |
545 | | $this->assertSame( $last_reply_id_f, bbp_forum_query_last_reply_id( $f ) ); |
| 545 | $this->assertSame( $r1, $last_reply_id_f ); |
546 | 546 | |
547 | 547 | // Get the categories last reply id. |
548 | 548 | $last_reply_id_c = bbp_get_forum_last_reply_id( $c ); |
549 | | $this->assertSame( $last_reply_id_c, bbp_forum_query_last_reply_id( $c ) ); |
| 549 | $this->assertSame( $r1, $last_reply_id_c ); |
550 | 550 | |
551 | | $this->factory->reply->create( array( |
| 551 | $r2 = $this->factory->reply->create( array( |
552 | 552 | 'post_parent' => $t, |
553 | 553 | 'reply_meta' => array( |
554 | 554 | 'forum_id' => $f, |
… |
… |
class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { |
558 | 558 | |
559 | 559 | // Get the forums last reply id. |
560 | 560 | $last_reply_id_f = bbp_get_forum_last_reply_id( $f ); |
561 | | $this->assertSame( $last_reply_id_f, bbp_forum_query_last_reply_id( $f ) ); |
| 561 | $this->assertSame( $r2, $last_reply_id_f ); |
562 | 562 | |
563 | 563 | // Get the categories last reply id. |
564 | 564 | $last_reply_id_c = bbp_get_forum_last_reply_id( $c ); |
565 | | $this->assertSame( $last_reply_id_c, bbp_forum_query_last_reply_id( $c ) ); |
| 565 | $this->assertSame( $r2, $last_reply_id_c ); |
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
diff --git tests/phpunit/testcases/topics/functions/status.php tests/phpunit/testcases/topics/functions/status.php
index 2f56fde9..71da3bcc 100644
|
|
class BBP_Tests_Topics_Functions_Status extends BBP_UnitTestCase { |
147 | 147 | $this->assertSame( bbp_get_spam_status_id(), $topic_spam_status ); |
148 | 148 | |
149 | 149 | $topic_meta_pre_spammed_replies = get_post_meta( $t, '_bbp_pre_spammed_replies', true ); |
150 | | $this->assertEquals( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies ); |
| 150 | $this->assertEqualSets( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies ); |
151 | 151 | |
152 | 152 | $topic_spam_meta_status = get_post_meta( $t, '_bbp_spam_meta_status', true ); |
153 | 153 | $this->assertSame( bbp_get_public_status_id(), $topic_spam_meta_status ); |
… |
… |
class BBP_Tests_Topics_Functions_Status extends BBP_UnitTestCase { |
214 | 214 | $this->assertSame( $topic_time, $last_active_time ); |
215 | 215 | |
216 | 216 | $topic_meta_pre_spammed_replies = get_post_meta( $t, '_bbp_pre_spammed_replies', true ); |
217 | | $this->assertEquals( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies ); |
| 217 | $this->assertEqualSets( array( $r[1], $r[0] ), $topic_meta_pre_spammed_replies ); |
218 | 218 | |
219 | 219 | foreach ( $r as $reply ) { |
220 | 220 | $reply_status = get_post_status( $reply ); |