XF 2.0 Using mover to move a thread and set prefix, what have I missed?

Marcel

Active member
PHP:
$mover = \XF::app()->service('XF:Thread\Mover', $thread);
if ($forum->ut_archive_prefix_id)
{
    $mover->setPrefix($forum->ut_archive_prefix_id);
}
else if ($destinationForum->default_prefix_id)
{
    $mover->setPrefix($destinationForum->default_prefix_id);
}
$mover->move($destinationForum);

Pseudo : If current forum has ut_archive_prefix_id set...then use that
If not, then check if the destination has a default prefix_id. If so, use that.
If not...then leave as is and move the thread.

The relevant fields are all set, it just moves the thread with no prefix at all.
 
Oh bumnuggets. My bad!
The prefix set in $forum->ut_archive_prefix_id must be available to the destination forum or else it just strips it out.
 
Back
Top Bottom