ForestForTrees
Well-known member
Hi folks,
This is a bit of a newbie question, but I'd be super grateful if you could help out.
Within a simple Cron Callback, if I have a thread_id, how do I get the post_id for the first post in the thread?
It's is simple as that. For background, see the following:
I've got the following cron entry:
The Callback, runMoveThreads is super simple. It gathers all the threads in a given subforum:
It then moves those threads, one by one, to a new subforum. It is based on code from @Fuhrmann's tutorial on how to make a Cron Entry to move threads. I've been using it for years, so I know it works.
I'd like to change the post date for the first post in each of the found threads. For that, I need the post_id of the the first post in the thread.
Given the above code and the context of a cron job, how do I find the post_id of the first post of the thread?
The code I will be calling afteward is taken directly from @AndyB 's wonderful Change Date addon, so it is solid, too:
(Okay, I lie, there is a bit of code after that that updates xf_forum if the thread is now the most recent one, but I can handle that.)
For the right person, this is probably a trivial, single line of code, but I'm afraid that I don't know the inner workings of XF. I'm under a lot of time pressure and would be super grateful for the help.
This is a bit of a newbie question, but I'd be super grateful if you could help out.
Within a simple Cron Callback, if I have a thread_id, how do I get the post_id for the first post in the thread?
It's is simple as that. For background, see the following:
I've got the following cron entry:
The Callback, runMoveThreads is super simple. It gathers all the threads in a given subforum:
It then moves those threads, one by one, to a new subforum. It is based on code from @Fuhrmann's tutorial on how to make a Cron Entry to move threads. I've been using it for years, so I know it works.
I'd like to change the post date for the first post in each of the found threads. For that, I need the post_id of the the first post in the thread.
Given the above code and the context of a cron job, how do I find the post_id of the first post of the thread?
The code I will be calling afteward is taken directly from @AndyB 's wonderful Change Date addon, so it is solid, too:
(Okay, I lie, there is a bit of code after that that updates xf_forum if the thread is now the most recent one, but I can handle that.)
For the right person, this is probably a trivial, single line of code, but I'm afraid that I don't know the inner workings of XF. I'm under a lot of time pressure and would be super grateful for the help.