XF 1.4 user_id cannot be NULL error

grantus

Active member
I've had this error in the past but I can't remember what solved it. When I tried to run the user promotions cache, I got this:

Code:
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Column 'user_id' cannot be null - library/Zend/Db/Statement/Mysqli.php:214

And also:

Code:
#0 /home/ill/public_html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/ill/public_html/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/ill/public_html/library/XenForo/Model/UserGroupPromotion.php(372): Zend_Db_Adapter_Abstract->query('\n\t\t\tINSERT INTO...', Array)
#3 /home/ill/public_html/library/XenForo/Model/UserGroupPromotion.php(319): XenForo_Model_UserGroupPromotion->insertPromotionLogEntry(1, NULL, 'automatic')
#4 /home/ill/public_html/library/XenForo/Model/UserGroupPromotion.php(289): XenForo_Model_UserGroupPromotion->promoteUser(Array, NULL)
#5 /home/ill/public_html/library/XenForo/Deferred/UserGroupPromotion.php(50): XenForo_Model_UserGroupPromotion->updatePromotionsForUser(Array, Array, Array)
#6 /home/ill/public_html/library/XenForo/Model/Deferred.php(294): XenForo_Deferred_UserGroupPromotion->execute(Array, Array, 7.99999690056, '')
#7 /home/ill/public_html/library/XenForo/Model/Deferred.php(428): XenForo_Model_Deferred->runDeferred(Array, 7.99999690056, '', false)
#8 /home/ill/public_html/library/XenForo/Model/Deferred.php(373): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#9 /home/ill/public_html/library/XenForo/ControllerAdmin/Tools.php(159): XenForo_Model_Deferred->run(true, NULL, '', false)
#10 /home/ill/public_html/library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_Tools->actionRunDeferred()
#11 /home/ill/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#12 /home/ill/public_html/admin.php(13): XenForo_FrontController->run()
#13 {main}

I know it's something in one of the tables but I can't remember which. Any ideas?

Thanks.
 
This is more likely to be related to a user that is lacking records in all tables. Have you manipulated the DB in anyway, such as manually inserting users (or using a non-standard importer)?
 
This is more likely to be related to a user that is lacking records in all tables. Have you manipulated the DB in anyway, such as manually inserting users (or using a non-standard importer)?
No, I haven't modified anything. I just went through each table and checked to see if there were any user_id columns that had a zero value, but that's all I can think of. I wish the error would say what table is causing it. Do you think it could be a column value that is NULL, and not the user_id NULL? Because I've only seen zero for user_id columns.
 
Well it turns out that the usergroup promotion I had set up was the problem. I removed it and then the errors were gone. But why would it do that? It's just a promotion that I added and I would like to keep it. Any ideas?
 
It's more likely to be a user that was being promoted that was the problem. The issue is that the user has records missing in certain tables. I'm trying to figure out how that might have happened; it's not something that would have happened within XF itself.

If you submit a ticket referencing this thread with phpMyAdmin access, I can check to ensure all users have the correct entries.
 
Back
Top Bottom