[wp-trac] [WordPress Trac] #40035: Site registered date uses different time zone from last updated

WordPress Trac noreply at wordpress.org
Sun Mar 5 08:56:18 UTC 2017


#40035: Site registered date uses different time zone from last updated
--------------------------------+-----------------------------
 Reporter:  nnikolov            |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  4.7.2
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 '''The problem'''
 In a multisite, when a new site is created, the registered date and time
 is stored using the time zone setting for the main network site, but the
 last updated date and time uses the GMT time. This inconsistency is
 confusing and also can lead to last updated time that is before the
 registered time, which is impossible.

 '''How to reproduce?'''
 1. Using WordPress 4.7.2 and a multisite installation log-in as Super
 Admin.
 2. Go to the General settings of the main network site and change your
 time zone to UTC+3 (or anything different from UTC).
 3. Go to Network admin -> Sites -> Add New, and create a new site.
 4. Click Edit Site after it is created and see that the registered date
 and time is different from the last updated date and time (they should be
 the same).

 '''How to fix?'''
 The problem is on line 1330 in the file /wp-includes/ms-functions.php.
 Currently the line is like this:
 {{{#!php
 $result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id,
 'domain' => $domain, 'path' => $path, 'registered' =>
 current_time('mysql')) );
 }}}
 Needs to be like this:
 {{{#!php
 $result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id,
 'domain' => $domain, 'path' => $path, 'registered' =>
 current_time('mysql', true)) );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40035>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list