[TH] Custom Fields [Deleted]

Hey

I installed this plugin, but I do not know where it will look and does it work XenForo v2.0.11 ??
Can someone guide you?

Thank you!
 
Hey

I installed this plugin, but I do not know where it will look and does it work XenForo v2.0.11 ??
Can someone guide you?

Thank you!
This addon only works with the XenForo 1.x versions.
It will not work for the 2.x version.

In Xenforo 2.x we don't need this addon. Custom User Fields and Custom Thread Fields are integrated in the software, you don't need an addon.

Admin Control Panel -> Forums -> Custom thread fields
Admin Control Panel -> Users -> Custom user fields
 
@Jake B.

Got the following error, even with the unicode conversion of the DB

XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xE9 /...' for column 'field_value' at row 1 in src\XF\Db\AbstractStatement.php at line 212
  1. XF\Db\AbstractStatement->getException() insrc\XF\Db\Mysqli\Statement.php at line 196
  2. XF\Db\Mysqli\Statement->getException() insrc\XF\Db\Mysqli\Statement.php at line 78
  3. XF\Db\Mysqli\Statement->execute() in src\XF\Db\AbstractAdapter.phpat line 79
  4. XF\Db\AbstractAdapter->query() in src\XF\Db\AbstractAdapter.php at line 207
  5. XF\Db\AbstractAdapter->insertBulk() insrc\XF\Behavior\CustomFieldsHolder.php at line 149
  6. XF\Behavior\CustomFieldsHolder->postSave() insrc\XF\Mvc\Entity\Entity.php at line 1168
  7. XF\Mvc\Entity\Entity->save() insrc\addons\ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1.php at line 167
  8. ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1->stepThreadFieldValues() in src\XF\Import\Runner.php at line 160
  9. XF\Import\Runner->runStep() in src\XF\Import\Runner.php at line 74
  10. XF\Import\Runner->run() in src\XF\Admin\Controller\Import.php at line232
  11. XF\Admin\Controller\Import->actionRun() insrc\XF\Mvc\Dispatcher.php at line 249
  12. XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 89
  13. XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 41
  14. XF\Mvc\Dispatcher->run() in src\XF\App.php at line 1934
  15. XF\App->run() in src\XF.php at line 333
  16. XF::runApp() in admin.php at line 13
 
@Jake B.

Got the following error, even with the unicode conversion of the DB

XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xE9 /...' for column 'field_value' at row 1 in src\XF\Db\AbstractStatement.php at line 212
  1. XF\Db\AbstractStatement->getException() insrc\XF\Db\Mysqli\Statement.php at line 196
  2. XF\Db\Mysqli\Statement->getException() insrc\XF\Db\Mysqli\Statement.php at line 78
  3. XF\Db\Mysqli\Statement->execute() in src\XF\Db\AbstractAdapter.phpat line 79
  4. XF\Db\AbstractAdapter->query() in src\XF\Db\AbstractAdapter.php at line 207
  5. XF\Db\AbstractAdapter->insertBulk() insrc\XF\Behavior\CustomFieldsHolder.php at line 149
  6. XF\Behavior\CustomFieldsHolder->postSave() insrc\XF\Mvc\Entity\Entity.php at line 1168
  7. XF\Mvc\Entity\Entity->save() insrc\addons\ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1.php at line 167
  8. ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1->stepThreadFieldValues() in src\XF\Import\Runner.php at line 160
  9. XF\Import\Runner->runStep() in src\XF\Import\Runner.php at line 74
  10. XF\Import\Runner->run() in src\XF\Admin\Controller\Import.php at line232
  11. XF\Admin\Controller\Import->actionRun() insrc\XF\Mvc\Dispatcher.php at line 249
  12. XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 89
  13. XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 41
  14. XF\Mvc\Dispatcher->run() in src\XF\App.php at line 1934
  15. XF\App->run() in src\XF.php at line 333
  16. XF::runApp() in admin.php at line 13

I fixed the issue by doing the following

Go to src\addons\ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1.php

Add the following In the stepThreadFieldValues method

foreach ($customFields as $key=>&$value) { $value = utf8_encode($value); }

Above

$th = \XF::em()->find('XF:Thread', $thread['thread_id']); $th->custom_fields->bulkSet($customFields); $th->save();
 
Getting this error while running the import. Can someone please help with this.

Code:
ErrorException: [E_WARNING] Invalid argument supplied for foreach() src/addons/ThemeHouse/CustomFieldImporter/Import/Importer/XenForo1.php:159

Stack trace
#0 src/addons/ThemeHouse/CustomFieldImporter/Import/Importer/XenForo1.php(159): XF::handlePhpError(2, '[E_WARNING] Inv...', '/opt/bitnami/ap...', 159, Array)
#1 src/XF/Import/Runner.php(231): ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1->stepThreadFieldValues(Object(XF\Import\StepState), Array, 8)
#2 src/XF/Import/Runner.php(59): XF\Import\Runner->runStep('threadFieldValu...', Object(XF\Import\StepState), 8)
#3 src/XF/Admin/Controller/Import.php(234): XF\Import\Runner->run()
#4 src/XF/Mvc/Dispatcher.php(321): XF\Admin\Controller\Import->actionRun(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Import', 'Run', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#6 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#7 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#9 src/XF.php(390): XF\App->run()
#10 admin.php(13): XF::runApp('XF\\Admin\\App')
#11 {main}
Request state
array(4) {
  ["url"] => string(31) "/community/admin.php?import/run"
  ["referrer"] => string(51) "xyz/community/admin.php?import/run"
  ["_GET"] => array(1) {
    ["import/run"] => string(0) ""
  }
  ["_POST"] => array(1) {
    ["_xfToken"] => string(8) "********"
  }
}

@Jake B. - Tagging you coz you might have unsubscribed to the thread. Would you be able to suggest something here. Thanks!
 
Last edited:
We have completed an importer for XenForo 2 that will allow you to import your custom fields into the default system within XenForo. However, there are a few quirks that need to be addressed before running it:

  • The testing on this add-on has been limited to fields created by our team as well as a couple of people who use this add-on that have upgraded already, so there may be edge cases that were missed. We will try to address these if we can.
  • Some data, such as required state, is not imported due to the differences in the way this works between XenForo 2 and this add-on
  • If any of your custom fields use either a callback or regular expression for validation the field will be reset to have no validation, so you will need to recreate your regular expression or PHP callback once you run the importer. This is due to the differences in the way XenForo 2 handles regular expression validations.

Please do test this on a clone of your site before running the upgrade on your actual database, and as always make sure you do keep backups in case of something not going quite right.
Does anyone know if the importer is working with XF 2.1?
 
The importer doesn't appear to work with XF 2.1. Before I upgrade my 1.5 forum, I assume I'll need to upgrade to 2.0.x, run the importer, then upgrade to 2.1.

Does anyone have an exact version that works?

Code:
F\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry 'age' for key 'PRIMARY' in src/XF/Db/AbstractStatement.php at line 217

    XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
    XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 77
    XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
    XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 221
    XF\Db\AbstractAdapter->insert() in src/XF/Import/Data/EntityEmulator.php at line 326
    XF\Import\Data\EntityEmulator->insert() in src/XF/Import/Data/AbstractEmulatedData.php at line 55
    XF\Import\Data\AbstractEmulatedData->write() in src/XF/Import/Data/AbstractData.php at line 127
    XF\Import\Data\AbstractData->save() in src/addons/ThemeHouse/CustomFieldImporter/Import/Importer/XenForo1.php at line 126
    ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1->stepThreadFields() in src/XF/Import/Runner.php at line 231
    XF\Import\Runner->runStep() in src/XF/Import/Runner.php at line 59
    XF\Import\Runner->run() in src/XF/Admin/Controller/Import.php at line 234
    XF\Admin\Controller\Import->actionRun() in src/XF/Mvc/Dispatcher.php at line 321
    XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
    XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
    XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
    XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
    XF\App->run() in src/XF.php at line 390
    XF::runApp() in admin.php at line 13
 
Last edited:
We have completed an importer for XenForo 2 that will allow you to import your custom fields into the default system within XenForo. However, there are a few quirks that need to be addressed before running it:

  • The testing on this add-on has been limited to fields created by our team as well as a couple of people who use this add-on that have upgraded already, so there may be edge cases that were missed. We will try to address these if we can.
  • Some data, such as required state, is not imported due to the differences in the way this works between XenForo 2 and this add-on
  • If any of your custom fields use either a callback or regular expression for validation the field will be reset to have no validation, so you will need to recreate your regular expression or PHP callback once you run the importer. This is due to the differences in the way XenForo 2 handles regular expression validations.

Please do test this on a clone of your site before running the upgrade on your actual database, and as always make sure you do keep backups in case of something not going quite right.

Will do pretty much anything to get this importer working with XF 2.1... :cry:
 
Getting this error while running the import. Can someone please help with this.

Code:
ErrorException: [E_WARNING] Invalid argument supplied for foreach() src/addons/ThemeHouse/CustomFieldImporter/Import/Importer/XenForo1.php:159

Stack trace
#0 src/addons/ThemeHouse/CustomFieldImporter/Import/Importer/XenForo1.php(159): XF::handlePhpError(2, '[E_WARNING] Inv...', '/opt/bitnami/ap...', 159, Array)
#1 src/XF/Import/Runner.php(231): ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1->stepThreadFieldValues(Object(XF\Import\StepState), Array, 8)
#2 src/XF/Import/Runner.php(59): XF\Import\Runner->runStep('threadFieldValu...', Object(XF\Import\StepState), 8)
#3 src/XF/Admin/Controller/Import.php(234): XF\Import\Runner->run()
#4 src/XF/Mvc/Dispatcher.php(321): XF\Admin\Controller\Import->actionRun(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Import', 'Run', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#6 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#7 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#9 src/XF.php(390): XF\App->run()
#10 admin.php(13): XF::runApp('XF\\Admin\\App')
#11 {main}
Request state
array(4) {
  ["url"] => string(31) "/community/admin.php?import/run"
  ["referrer"] => string(51) "xyz/community/admin.php?import/run"
  ["_GET"] => array(1) {
    ["import/run"] => string(0) ""
  }
  ["_POST"] => array(1) {
    ["_xfToken"] => string(8) "********"
  }
}

@Jake B. - Tagging you coz you might have unsubscribed to the thread. Would you be able to suggest something here. Thanks!

Did you find a fix? We've got the same error, assuming because we're importing to XF 2.1
 
Are there any instructions for this importer? When do we run it - before or after upgrading to xf v2? which version of v2.0 is best? Install instructions?
 
The importer doesn't appear to work with XF 2.1. Before I upgrade my 1.5 forum, I assume I'll need to upgrade to 2.0.x, run the importer, then upgrade to 2.1.

Does anyone have an exact version that works?
Are there any instructions for this importer? When do we run it - before or after upgrading to xf v2? which version of v2.0 is best? Install instructions?
The last version of this add-on was released in December, the XF version released just before this add-on was 2.0.12. So try giving that a whirl.
 
I'm trying a simple rename of the xf_thread_fields_value__conflict table (which has old data in it), to xf_thread_fields_value. Another user did this and found it worked after rebuilding caches...
 
I'm a bit confused. I'm preparing to upgrade my site from XF 1.5 to 2.1.10. I have multiple custom fields set up in XF 1 which I would like to keep in the XF2 installation.. At what stage do I use the importer? Thanks.
 
I'm assuming the importer is still broken with 2.1?

Code:
ErrorException: [E_WARNING] Invalid argument supplied for foreach() in src/addons/ThemeHouse/CustomFieldImporter/Import/Importer/XenForo1.php at line 159
XF::handlePhpError() in src/addons/ThemeHouse/CustomFieldImporter/Import/Importer/XenForo1.php at line 159
ThemeHouse\CustomFieldImporter\Import\Importer\XenForo1->stepThreadFieldValues() in src/XF/Import/Runner.php at line 231
XF\Import\Runner->runStep() in src/XF/Import/Runner.php at line 59
XF\Import\Runner->run() in src/XF/Admin/Controller/Import.php at line 234
XF\Admin\Controller\Import->actionRun() in src/XF/Mvc/Dispatcher.php at line 350
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2190
XF\App->run() in src/XF.php at line 391
XF::runApp() in admin.php at line 13
 
Makes me wish we had upgraded sooner. I'd like to thank @ThemeHouse for providing this import and being very timely and helpful with support both in the present and past. It works like a charm for us with 2.0.12, PHP 7.3, and requires hitting the 'install' in the control panel to install the addon and then going to the Imports area to import the field(s), selecting the field that should show up. Our custom field was simple and I renamed the table to ensure there wouldn't be any conflicts. Hopefully this will save some of you latecomers with some time.

 
Back
Top Bottom