1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Closed Suggestions' started by guiltar, Jan 16, 2012.

  1. guiltar

    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.
        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(
    // 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
    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:
    $limit XenForo_Application::get('options')->maxNewPostsByAjax
    Yoskaldyr likes this.

Share This Page