Forum breadcrumbs – You are here:Asgaros Support ForumSupportLast Post Date
Please or Register to create posts and topics.

Last Post Date

I have an issue with my forum (which may or may not be caused by the migration of my old forum data) where the topic order in each forum is incorrect and the “last post” column on the forum list shows incorrect data. I can fix the in-forum issues with custom_asgarosforum_filter_get_posts_order and custom_asgarosforum_filter_get_threads_order but I can’t fix the forum list issue. For now, I’ve changed functions get_lastpost_in_topic and get_lastpost_in_forum to order by date instead of id and it’s fixed my issue. Any chance you can add a filter to allow me to override that without changing Asgaros forum code?

Thanks.

Same for load_activity_data please?

Hello @beezer

I guess this issue is caused by your migration and the way in how you imported/exported your data. In Asgaros Forum the ID is used to determine last-posts, the topic-author, last-post links, unread-data, etc. Changing this manually via filters/hooks to date-ordering is possible, but it really must be done for every query which relies on a post ID in combination with its ordering.

This also will lead to problems in the future whenever I made some changes to the logic or its queries or introduce new functionality.

I highly recommend you to import the data again in some kind of ordered way. For example you can sort and export all posts, ordered by date. And import them again into the posts-table without a given ID-value so that the auto-increment values are applied in the correct order.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks Asgaros,

The data was already imported with auto-increment but I guess I didn’t take care to use date order when I did it. It’s more work than I want to run the import again, so I guess I’ll run with my “fixes” for a while and then let them get overwritten when you release a new version. By then the threads will be old enough that no one will even notice that they’re out of order 🙂

Asgaros has reacted to this post.
Asgaros

I fixed this. I created an empty copy of the wp_forum_posts table, ran a script to select each post in date order and write it into the new table (with auto-increment id) then rename the tables so new replaced old. Now the forum works fine out of the box. I did have to drop a few “likes” from the reactions table, but I don’t care too much about them 🙂

 

edit: That didn’t work. Lost all attachments. Back to the drawing board 🙁

Hello @beezer

The uploaded files are stored for each post in a folder based on its post-id to ensure uniqueness. So basically they are not lost, but there is just no folder anymore which matches to the post-id. So what your script has to do is:

  • check if uploads are registered inside the upload-field for a post
  • copy that post to your new table (as before)
  • get the new ID of this post
  • rename the folder so it matches to the new ID
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

This worked. Now I’m able to just update my forum install without customizing the sql each time 🙂

Asgaros has reacted to this post.
Asgaros