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

Why is this dude's post last?

tenants

Well-known member
#2
That is strange, and the order of the posts numbers are:

1 #post-146735 26 minutes ago
2 #post-124432 May 31, 2012 << has anything been done to this posts, like moving/moderating
3 #post-146748 19 minutes ago

Sorry for asking the obvious, but do you use any plug-ins for ordering posts (like pinning posts / bumping posts)

I remember looking at how posts were ordered, I'll try to dig out the query and at it here

edit, here:

Code:
    public function getPostsInThread($threadId, array $fetchOptions = array())
    {
        $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);
        $stateLimit = $this->prepareStateLimitFromConditions($fetchOptions, 'post');
        $joinOptions = $this->preparePostJoinOptions($fetchOptions);
 
        return $this->fetchAllKeyed('
            SELECT post.*
                ' . $joinOptions['selectFields'] . '
            FROM xf_post AS post
            ' . $joinOptions['joinTables'] . '
            WHERE post.thread_id = ?
                ' . $this->addPositionLimit('post', $limitOptions['limit'], $limitOptions['offset']) . '
                AND (' . $stateLimit . ')
            ORDER BY post.position ASC, post.post_date ASC
        ', 'post_id', $threadId);
    }
The "ORDER BY post.position ASC, post.post_date ASC" being the important bit
So, it should sort first by position, and then by post date

Since the posts dates are not the same of these 3, it seems odd that #post-124432 appears in the middle. I would do a search on your plug-ins for the text "getPostsInThread" and find out what is changing it and how

[I use something called "Agent Ransack" to do my deep quick searches (windows search just doesn't cut it for me ;) )]
 

DRE

Well-known member
#3
lol I'm mentally exhausted after fixing errors in my mobile theme. I will investigate this later thanks. Only modification I know that affects the order of posts is xenporta.
 

tenants

Well-known member
#4
XenPorta's getPostsInThread:

Code:
    public function getPostsInThread($threadId, array $fetchOptions = array())
    {
        $options = XenForo_Application::get('options');
 
        if ($options->EWRporta_globalize['article'])
        {
            $fetchOptions['join'] += self::FETCH_THREAD;
 
            $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);
            $stateLimit = $this->prepareStateLimitFromConditions($fetchOptions, 'post');
            $joinOptions = $this->preparePostJoinOptions($fetchOptions);
 
            return $this->fetchAllKeyed('
                SELECT post.*
                    ' . $joinOptions['selectFields'] . '
                FROM xf_post AS post
                    ' . $joinOptions['joinTables'] . '
                WHERE post.thread_id = ?
                    AND (((' . $stateLimit . ')
                    ' . $this->addPositionLimit('post', $limitOptions['limit'], $limitOptions['offset']) . ')
                    OR post.post_id = thread.first_post_id)
                ORDER BY post.position ASC, post.post_date ASC
            ', 'post_id', $threadId);
        }
 
        return parent::getPostsInThread($threadId, $fetchOptions);
    }
Nothing strange with the ordering there, what happens if you turn off EWRporta_globalize['article']. If nothing, since this would make a call to parent when turned off, you can then rule out that it's an issue with XenPorta's getPostsInThread (but that doesn't rule out XenPorta)

I would then try turning off plug-ins one by one
 

DRE

Well-known member
#5
Wasn't sure if its a plugin or template error. It's such a weird error. That's the only thread I see that error in. Wondering if its even worth troubleshooting?
 

Jake Bunce

XenForo moderator
Staff member
#6
Have you experienced any problems with the server clock such as incorrect times being reported? Problems with the server clock can cause this.