Last Post Date
Quote from Beezer on November 19, 2018, 8:11 amI 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.
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.
Quote from Asgaros on November 20, 2018, 9:58 amHello @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.
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.
Quote from Beezer on November 21, 2018, 4:33 pmThanks 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 🙂
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 🙂
Quote from Beezer on November 29, 2018, 9:20 pmI 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 🙁
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 🙁
Quote from Asgaros on November 29, 2018, 10:34 pmHello @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
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
Quote from Beezer on December 4, 2018, 12:59 pmThis worked. Now I’m able to just update my forum install without customizing the sql each time 🙂
This worked. Now I’m able to just update my forum install without customizing the sql each time 🙂