News:

Wondering if this will always be free?  See why free is better.

Main Menu

Topics sorted by ID instead of last update?

Started by Red Squirrel, May 26, 2015, 12:20:30 AM

Previous topic - Next topic

Red Squirrel

I'm merging 4 different forums into one and just realized that topics are sorted by ID and not but the date of the last post. So when two forums are merged together all the first forum topics are at the end.

Is there a reason for this?  I'm thinking of just adding a field called last_update in the topics table and sorting by that, any reason why this is not already the way it works?  The topic needs to be updated by a new post anyway, so it could just update the date too.

also I see that the latest version is 2.1.x, is this stable or is this a beta?  Since this is going to be a new forum I'm thinking I should upgrade to latest before I start doing any kind of modding.

Kindred

2.1 is still in beta.


As for posts...yes, the sort order is by post I'd... Always has been.   It's a "cheaper" query.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Red Squirrel

I kind of figured it was an efficiency thing.  If I do as I suggested and just add a new field it should come up pretty much to same thing right?  I might just go ahead and do that, will make the merge easier and everything will just blend in regardless of IDs.

Kindred

thing is...    it's more complicated that you may think -- it's not just in the display of thread that you would have to adjust....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

Quote from: Red Squirrel on May 26, 2015, 01:05:06 AM
I kind of figured it was an efficiency thing.  If I do as I suggested and just add a new field it should come up pretty much to same thing right?  I might just go ahead and do that, will make the merge easier and everything will just blend in regardless of IDs.
Yes, it should. But you also have to change SMF's code to include that new field, because now SMF only stores/updates id_last_msg in smf_topics.
In order to keep it working (with past and future topics), you need to store this new field also. That includes Post, Split/Merge topics, delete posts, etc... Quite some work, really :(
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Red Squirrel

Yeah true, I will have to modify certain functions like delete, merge and so on. This is a brand new forum though so I don't have to account for existing topics which makes it a bit easier, otherwise I'd probably want to code in some kind of repair function.  What I can do too is sort by last_post_date (new field I add) then also ID.  Though that may add extra processing for nothing in the SQL query as it still needs to check both fields instead of one. I'll play around with it and see what I come up with.

Or is there perhaps a better approach to merging many topics from different forums together?

Kindred

there was a script that someone developed to do something of the sort... but I don't have the link handy...  it's not something that comes up often and was never really intended
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Red Squirrel

Yeah I kinda figured it was an oddball situation, TBH I started to write my own before I even realized there were a lot of SMF converters already even for super old version of IPB and stuff.  I'm merging phpbb, 2x IPB and 1x SMF into one SMF forum. I have the jist of it working but converting the emoticon formatting and stuff I still have to do, and I'll probably end up grabbing code from existing scripts for those parts, since why reinvent the wheel eh.

So think I'll go ahead and make the change so that it sorts by date, I'll have lot of testing to do to ensure the date gets updated accordingly by use of various tools like merge and so on too.

Advertisement: