• I ran into a problem where one of our users completed a partial import of some posts from tumblr and then broke the publish functionality of wordpress.

    The publish button was replaced with a submit for review button. After searching around on the site, I found that it was caused by an SQL error. Unfortunately, wordpress doesn’t show the error, so I enabled debugging on our mysql server to watch the queries.

    I noticed that the automatic draft post would insert okay, but then the next query for the ID would be incorrectly negative.

    The cause of the problem was the import process. It seemed to bump up the post IDs to the maximum signed integer size that PHP could handle on the 32-bit architecture (~2 billion something). So when the new draft would be inserted and wordpress would get back the new ID, it would wrap the integer around to be negative, and the subsequent SQL queries based off of that would fail because they wouldn’t match the DB.

    I had to write a custom script to crawl through our posts table and find any IDs greater than 2 billion, substract 2 billion from them and update the post_meta table as well. I then had to update the auto-increment value on the wp_posts table to start much lower so it wouldn’t keep issuing the large IDs.

    The real bug is in the import process, but I’m just putting this out there as something to keep in mind to save someone else from wasting a lot of time disabling plug-ins, etc.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I was having the same problem, I was getting the ‘Submit for Review’ error when I tried to publish a post.

    Summary of problem:

    1. Problem occured after an import
    2. Auto-drafts and newly created users were saving to the database with an ID == 0

    Solution:

    1. Delete all entries from the database with a primary key == 0 (posts, users, etc)
    2. Reset the primary key fields for all the tables to AUTO_INCREMENT

    Here is the sql code (you’ll want to check any tables created by your plugins and re AUTO_INCREMENT those as well) (Here is a text file with the code – pretty formatting ):
    ALTER TABLEsswp_commentmetaCHANGEmeta_idmeta_id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_comments CHANGE comment_ID comment_ID BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_links CHANGE link_id link_id BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_options CHANGE option_id option_id BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_postmeta CHANGE meta_id meta_id BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_posts CHANGE ID ID BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_terms CHANGE term_id term_id BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_term_taxonomy CHANGE term_taxonomy_id term_taxonomy_id BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_usermeta CHANGE umeta_id umeta_id BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ALTER TABLE sswp_users CHANGE ID ID BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT;
    ~

    `

    As an elaboration on blak111’s post, this is how I managed to fix this problem:

    First I repaired all tables.

    Then I made sure all primary keys had auto-increment.

    Then I checked the wp_posts table for records with insanely high ID’s, and I deleted all of them.

    Finally I reset the auto_increment value of the wp_posts table to a normal number, otherwise the database would start from the insanely high number again which would break WP and lead to the ‘Submit for review’ problem.

    You can reset the auto-increment value for the WP_Posts table by issuing this MySQL command:

    ALTER TABLE some_table AUTO_INCREMENT=1000

    Of course, you can set ‘1000’ in this example to anything you want. Make sure it is higher than the record with the highest number in the wp_posts table.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A cause of the "submit for review" problem’ is closed to new replies.