• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed XF to XF "Import Profile Posts"

DRE

Well-known member
#1
Got this error when importing Profile Posts

Mysqli statement execute error : Column 'user_id' cannot be null

  1. Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
  2. Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
  3. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
  4. Zend_Db_Adapter_Abstract->insert() in XenForo/Model/Ip.php at line 62
  5. XenForo_Model_Ip->logIp() in XenForo/Model/Import.php at line 1698
  6. XenForo_Model_Import->importIp() in XenForo/Model/Import.php at line 1209
  7. XenForo_Model_Import->importProfilePost() in XenForo/Importer/XenForo.php at line 1117
  8. XenForo_Importer_XenForo->stepProfilePosts() in XenForo/Importer/Abstract.php at line 77
  9. XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 180
  10. XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 132
  11. XenForo_ControllerAdmin_Import->actionImport() in XenForo/FrontController.php at line 337
  12. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  13. XenForo_FrontController->run() in /home/me/public_html/test/admin.php at line 13
 

DRE

Well-known member
#2
Oh I figured out the problem. Members who got deleted in the past, their profile posts have remained and so have their person conversations. Apparently the importer won't import Personal Conversations and Profile Posts if that conversation or profile post was made by a guest.
 

DRE

Well-known member
#3
There was a spammer named brindabenson and she has a soft-deleted profile post on alot of people's profiles (thank you for hiding the members list in Xenforo 1.2) so now I'm just manually deleting her profile posts. Pretty annoying since I have around 500 profiles to go through.
 

Chris D

XenForo developer
Staff member
#7
I think it's just:

Code:
DELETE FROM xf_profile_post WHERE user_id = ?
Or, as long as you're certain the username is correct:

Code:
DELETE FROM xf_profile_post WHERE username = 'brendabenson'
 

DRE

Well-known member
#8
I think it's just:

Code:
DELETE FROM xf_profile_post WHERE user_id = ?
Or, as long as you're certain the username is correct:

Code:
DELETE FROM xf_profile_post WHERE username = 'brendabenson'
How would I delete posts this way?
and conversation messages?
 

DRE

Well-known member
#9
Nevermind this problem is worse than I thought. I saw more deleted accounts (deleted spammers) on both profile posts and threads. I don't know all their usernames. I will have to wait for the next version of this importer and cross my fingers that it ignores guests during the import.
 

Kier

XenForo Developer
Staff member
#10
Nevermind this problem is worse than I thought. I saw more deleted accounts (deleted spammers) on both profile posts and threads. I don't know all their usernames. I will have to wait for the next version of this importer and cross my fingers that it ignores guests during the import.
Reading back through my code, I can see that Profile Posts will error when encountering a guest (or deleted user) profile post - and I've now resolved that, but the Threads and Posts import should work fine with guest posts.
 

Kier

XenForo Developer
Staff member
#11
If you want to try applying my fix to profile posts, you need to add a default 0 to the map look-ups for user_id in profile posts and profile post comments as you can see with this diff.

Screen Shot 2013-08-05 at 12.02.11.png