While converting a website from single to multisite I bumped into an issue while creating accounts. When looking into the logs I noticed:
WordPress database error Unknown column ‘spam’ in ‘field list’ for query INSERT INTO wp_users
The issue is clear, i’m missing the ‘spam’ column in wp_users. Since i’m running this environment in Docker and I didn’t have easy database access available I wrote a wp-cli command fixing this issue;
Thanks to RJT for improving the script!
Hi Marinus,
I am facing the same issue in WordPress Bitnami Stack, how do I do this, is there is step by step guide, I’m not familiar with CLI of WP.
Thank you
Hi there – you can access your database and run the following command: ALTER TABLE wp_users ADD spam TINYINT
Thank You! It work for me.
Thanks so much for this.. It worked
When I run that command, with root user, I receive the error:
“Invalid default value for ‘user_registered'”
Any thoughts?
Seems like something is wrong with the user_registered column in your table. I would have to have a look myself in order to give further advice. Feel free to reach out by email!
Thanks to your article, I solved my issue, thank you very much !
Happy to hear that!
Important addition: the database column should default to 0 not null, so the query should be:
ALTER TABLE wp_users ADD spam TINYINT NOT NULL DEFAULT 0;
If the spam column is missing, it’s likely the the ‘deleted’ column is also missing (both should be added when converting to multisite). This should column also needs to be added.
ALTER TABLE wp_users ADD deleted TINYINT NOT NULL DEFAULT 0;
Thanks! I’ve updated the script according to your recommendations.
Thank you very much, you have saved my life with a multisite. It works perfectly
Glad to hear that!
Hey thanks for this bro! I got same problem —- members not displaying in BP – Members page, and new users activation error “invalid activation key”. Got all resolved!
Thank you! You saved my day
Thank goodness for this article. I migrated my single site to multisite using Migrate Guru and it went perfectly well except for this problem. I banged my head against the wall for hours but now it’s fixed. Thanks!