I change the order in which posts are displayed in a thread by extending the class:
The display of posts in threads has met my wishes
However, when the user submits the add-reply, the post is displayed under the lastpost. After reloading the page, it shows up again according to my wishes (
How do I Insert new post before first in thread without having to reload thread
Thanks!
PHP:
<?php
use XF\Mvc\Entity\Finder;
use XF\Mvc\Entity\Repository;
namespace HT\ForumImplement\Repository;
class Thread extends XFCP_Thread
{
public function getDefaultPostListSortOptionsRd(): array
{
return [
'post_date' => [
['position', 'DESC'],
['post_date', 'DESC'],
]
];
}
}
However, when the user submits the add-reply, the post is displayed under the lastpost. After reloading the page, it shows up again according to my wishes (
['position', 'DESC'], ['post_date', 'DESC']
)How do I Insert new post before first in thread without having to reload thread
Thanks!