vBulletin: Category node for FAQ pages is always created when retaining IDs

Kirby

Well-known member
Affected version
1.5.2
When importing FAQ items from vBulletin while retaining IDs, a category node for FAQ items is always created:

PHP:
    /**
     * When $retainIds is set, creates a category node in order to store all FAQ
     * entries imported as XF pages, which would otherwise be scattered all over
     * the node tree.
     *
     * @param array $stepConfig
     */
    public function setupStepFaq(array $stepConfig)
    {
        if (
            $this->session->retainIds &&
            empty($this->session->extra['faqParentNodeId'])
        )
        {
            $this->createImportNodeParentIfNecessary();

            /** @var \XF\Import\Data\Node $parentNode */
            $parentNode = $this->newHandler('XF:Node');

            $parentNode->parent_node_id = $this->getImportNodeParentId();
            $parentNode->title = $stepConfig['parent_node_title'];
            $parentNode->display_order = 20;

            $parentType = $this->newHandler('XF:Category');
            $parentNode->setType('Category', $parentType);

            $this->session->extra['faqParentNodeId'] = $parentNode->save(false);
        }
    }

This is unnecessary when importing FAQ items as help pages, the category will stay empty and must be deleted afterwards.
 
Top