Lack of interest [suggestion] New posts by ajax limit option

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

guiltar

Well-known member
Hey, Developers!
I'm writing threaded comments addon and trying to extend the method actionAddReply of class XenForo_ControllerPublic_Thread.
It has to return all the new posts via ajax request.
But there is a fixed limit of shown posts in engine: 3.
PHP:
    public function actionAddReply()
    {
              ....
            // the max number of posts we want to fetch
            $limit = 3;
 
            $postFetchOptions = $this->_getPostFetchOptions($thread, $forum);
            $postFetchOptions += array(
                'limit' => ($limit + 1),
            );
               ......
            $posts = $postModel->getNewestPostsInThreadAfterDate(
                $threadId, $lastDate, $postFetchOptions
            );
 
            // We fetched one more post than needed, if more than $limit posts were returned,
            // we can show the 'there are more posts' notice
            if (count($posts) > $limit)
            {
                 ....
                // remove the extra post
                array_pop($posts);
            }
            ....

If the number of posts returned by model is more then 3, then the earliest post will be removed.
And there is no nice way to extend it without rewriting all the method.
So, please, do the var $limit controllable by extensions. For example, it can be taken from registry:
PHP:
$limit = XenForo_Application::get('options')->maxNewPostsByAjax
 
Upvote 1
This suggestion has been closed. Votes are no longer accepted.
Top Bottom