Marcel
Active member
This is a followon from this question :
http://xenforo.com/community/thread...ads-works-with-all-prefixes-except-one.64489/
I started the whole plugin again from scratch. I now have the other part of the plugin running fine (One click assign a particular prefix to a thread).
I've integrated the cron job as per the above link, and it works.
It moves the relevant threads (For some reason the code on the above link wouldn't actually select the threads with prefixId of 1).
Anway, it works. However, it removes the thread's prefix upon move.
here's the relevant part of the function that is called to move the threads.
I don't actually want to change the prefix at all, but if I leave it out, it still strips it. It's more than likely me doing something that Im not supposed to be doing, or doing it the wrong way. Could anyone help? Thanks.
http://xenforo.com/community/thread...ads-works-with-all-prefixes-except-one.64489/
I started the whole plugin again from scratch. I now have the other part of the plugin running fine (One click assign a particular prefix to a thread).
I've integrated the cron job as per the above link, and it works.
It moves the relevant threads (For some reason the code on the above link wouldn't actually select the threads with prefixId of 1).
Anway, it works. However, it removes the thread's prefix upon move.
here's the relevant part of the function that is called to move the threads.
Code:
$threads = $threadModel->getThreads($conditionals, $fetchOptions);
// $threads now contains all our results, so let's run through and deal with them on a thread by thread basis
// firstly, make sure there were some results. We don't want to be bothering if there was nothing found!
if ($threads)
{
// go through $threads, and put just one thread into $thread
foreach ($threads as $thread)
{
// instantiate the datawriter as $dw
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
// point this new datawriter to the thread we're currently dealing with
$dw->setExistingData($thread);
// change the information contained in it (IE, our destination forum)
$dw->set('node_id', $msOptions['destForum']);
$dw->set('prefix_id', $msOptions['prefix']);
// now save it
$dw->save();
// done! now either end the foreach loop, or go back and do the next thread we found
}
}
I don't actually want to change the prefix at all, but if I leave it out, it still strips it. It's more than likely me doing something that Im not supposed to be doing, or doing it the wrong way. Could anyone help? Thanks.