WordPress.org

Forums

WP Db Abstraction
Doesn't work with 3.6.1 Cannot insert new posts (7 posts)

  1. charliebrimm
    Member
    Posted 1 year ago #

    I cannot create new posts when a user is an admin or editor on more than one blog in multisite.

    I can create posts from the dashboard in quick press.

    The part of the plugin that replaces dates (translate_insert_nulltime) doesn't correct the query and is sent along where SQL complains that the date is 0000-00-00 00:00:00 and the insert fails.

    Any help would be appreciated.

    http://wordpress.org/plugins/wordpress-database-abstraction/

  2. gresziu
    Member
    Posted 9 months ago #

    Hi, did u find a solution for this?
    I'm having same problem with 3.9.1 version.
    Please advise in case, thanks.

  3. charliebrimm
    Member
    Posted 9 months ago #

    Yes. SQL hates an empty date so assign the empty 0000-00-00 00:00:00 to post_date around line 3033 in wp-includes/post.php PLEASE NOTE I hate editing core files but this is what it took to make it work.

    if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
    		if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
    			$post_date_gmt = get_gmt_from_date($post_date);
    		else
    			//$post_date_gmt = '0000-00-00 00:00:00'; changed by  because sql doesn't like empty dates
    			$post_date_gmt = $post_date;
    	}
    
    	if ( $update || '0000-00-00 00:00:00' == $post_date ) {
    		$post_modified     = current_time( 'mysql' );
    		$post_modified_gmt = current_time( 'mysql', 1 );
    	} else {
    		$post_modified     = $post_date;
    		//$post_modified_gmt = $post_date_gmt; changed by  because sql doesn't like empty dates
    		$post_modified_gmt = $post_date;
    	}
  4. gresziu
    Member
    Posted 9 months ago #

    Thank you so much really!! That worked perfectly!! At the end was an easy fix! Thanks again!!

  5. charliebrimm
    Member
    Posted 9 months ago #

    That's great. Glad I could help!

  6. charliebrimm
    Member
    Posted 9 months ago #

    That's great. Glad I could help!

  7. profnimrod
    Member
    Posted 8 months ago #

    FYI The line number for WordPress 4.0 is 3220.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Db Abstraction
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic