[TH] Newest Post First [Deleted]

Uhoh! You are bug-fixer extraordinaire. If you can't fix it, what chance does a regular bug fixer like me have? Anyway, I'm struggling to replicate the issue. I'm wondering if it is a bug with MySql or something like that? I can't really see why though. The query is really simple.

Would you be able to give me access to your site so that I could do some more investigating?
No problem, I will do this later or tomorrow. I'm stilling in a cafe right now flooding Taiwanese companies with resume et cover letters ;)

P.S: I'm not good with sql ^^
 
I've checked and found:
> that the problem only occurs when a thread has several pages
> that the permalinks don't work anymore (they don't redirect to the correct page)
> that the result array from the sql has the first post... but this one is not displayed...

Can you check if you can reproduce the problem otherwise I will give you an access
 
I've checked and found:
> that the problem only occurs when a thread has several pages
> that the permalinks don't work anymore (they don't redirect to the correct page)
> that the result array from the sql has the first post... but this one is not displayed...

Can you check if you can reproduce the problem otherwise I will give you an access
I can confirm the issue with permalinks. I will fix this.

I can't confirm the other issue. If you could give me access and make sure that I have debug mode available, that would be great. Thank you.
 
I can confirm the issue with permalinks. I will fix this.

I can't confirm the other issue. If you could give me access and make sure that I have debug mode available, that would be great. Thank you.
I've check and it's working on my dev Board, so to avoid to make you lose some time, I've disabled one by one the other plugins and found the problem is when XenPorta is activated. I can't do further check now, I need to go. We will see that later.

Edit1: pb seems to come from XenPorta load_class_controller

Edit2: the problem is coming from this class: class EWRporta_ControllerPublic_Thread
And this line:
Code:
unset($response->params['posts'][$response->params['thread']['first_post_id']]);

I guess the conditional must be changed. I will look at this later.
 
Edit1: pb seems to come from XenPorta load_class_controller

Edit2: the problem is coming from this class: class EWRporta_ControllerPublic_Thread
And this line:
Code:
unset($response->params['posts'][$response->params['thread']['first_post_id']]);

I guess the conditional must be changed. I will look at this later.
The problem stems from EWRporta_Model_Post as both add-ons extend getPostsInThread and neither add-on seems to be very forgiving to any other add-on that wants to extend that method. XenPorta seems to request that first post on every page and then removes it in the controller.

In your installation, it sounds like my add-on is overriding XenForo_Model_Post after XenPorta, but if you installed the add-ons in the other order then my add-on would be first and would then be overridden by XenPorta as both have priority 10 and the posts would appear in the correct wrong order.

So, it appears the solution is as follows:
1) increase the priority of the load_class_model and load_class_controller listeners to > 10 (not necessary for your installation)
2) add code to Waindigo_NewestPostFirst_Model_Post to check whether XenPorta is installed and add the first post to the query if necessary
3) extend the actionIndex() method, caching the first post (if it is the last page) before calling the parent action, then adding it back again

I am assuming in 3) that there is a way of working out whether you are viewing the last page or not (there should be).

How does that sound?
 
If I get a chance, I'll code it myself.
I had a quick check and you're right the two addons should be in conflict if the option EWRporta_globalize['article'] is activated (Not sure what it is) since they return a different output.
But in my case it looks to be disabled. So the problem really comes from the unset cmd in the other class. And I'm missing the point to unset the first post.
 
Just realised I made a mistake. We would actually need to extend the controller twice. Once before XenPorta extends it (where we would fetch and store the first post if it is the last page) and once after (when we add back the first post that has been unset).

Might be easier just to edit the XenPorta file or to just use the option to display the first post first.
 
Just realised I made a mistake. We would actually need to extend the controller twice. Once before XenPorta extends it (where we would fetch and store the first post if it is the last page) and once after (when we add back the first post that has been unset).
That's clever!
But for now since I have a basic use of XenPorta (no article) I'm jut going to change the previous conditional:
From
Code:
        if (!empty($response->params['page']) && $response->params['page'] > 1)
        {
            unset($response->params['posts'][$response->params['thread']['first_post_id']]);
        }
To:
Code:
        if (!empty($format) && !empty($response->params['page']) && $response->params['page'] > 1)
        {
            unset($response->params['posts'][$response->params['thread']['first_post_id']]);
        }

It's working with my config.

It remains just the problems with permalinks. My friend who is using your addon reverse mode (It reminds me i need to send you something) also told me that when he opens a subject he didn't arrive on the first unread post. But it might me related to the previous problem. I will check that with him.
 
Just for the confirmation and for the future, your article mod doesn't use the $format variable $this->_input->filterSingle('format', XenForo_Input::STRING) to display articles ?
 
When this addon is installed and active, it keeps the post reply box at the top of the site even when you don't have posts reversed. Also, is it possible to add an option to turn off moving the post reply box? The way it is now is not where it's at in vBulettin or even some asp forums.

http://www.8thos.com/threads/everyone-post-here-testing-something.19932/

Screen Shot 2013-06-04 at 6.33.36 PM.webp
 
I checked the second box, then changed the settings in my preferences and I get the same results as above.

The only time it actually reverses the posts is when I check the "newest posts first box" in AdminCP options as default.
 
I checked the second box, then changed the settings in my preferences and I get the same results as above.

The only time it actually reverses the posts is when I check the "newest posts first box" in AdminCP options as default.
Are you sure? I can't replicate this.
 
  • Like
Reactions: DRE
All previous bugs fixed except one thing which I'm not exactly sure is a bug but when you have "Show original post first (blog style)" checked it shows the first post as the newest post, and not as the first on the first page or not as the first on the other pages. That looks verrrry confusing. I will not check that box since it isn't first post on all pages style.

With that said, thank you very much for this update and the extra option! Rating it 5 stars and donating when I get paid.
 
All previous bugs fixed except one thing which I'm not exactly sure is a bug but when you have "Show original post first (blog style)" checked it shows the first post as the newest post, and not as the first on the first page or not as the first on the other pages. That looks verrrry confusing. I will not check that box since it isn't first post on all pages style.
Not sure if it is at all related, but I did just notice that if you have that option selected and then post on the first page, it all gets seriously messed up. Waaay too tired to look at that now though.

With that said, thank you very much for this update and the extra option! Rating it 5 stars and donating when I get paid.
You're welcome. Bad news is that this add-on is going to break with XF 1.2 because of the new editor. Hopefully will be an easy fix though.
 
  • Like
Reactions: DRE
Top Bottom