Title: [Plugin: Editable Comments] issue with timezone offset
Last modified: August 19, 2016

---

# [Plugin: Editable Comments] issue with timezone offset

 *  [graymerica](https://wordpress.org/support/users/graymerica/)
 * (@graymerica)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-editable-comments-issue-with-timezone-offset/)
 * To get this to work I had to update the timezone from wordpress options. The 
   time zone of my server and the one set in WP are not the same.
 * I put the following in my functions.php to avoid editing the plugin code.
 * `date_default_timezone_set(get_option('timezone_string'));`
 * Andrew
 * [http://wordpress.org/extend/plugins/editable-comments/](http://wordpress.org/extend/plugins/editable-comments/)

Viewing 1 replies (of 1 total)

 *  [FolioVision](https://wordpress.org/support/users/foliovision/)
 * (@foliovision)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-editable-comments-issue-with-timezone-offset/#post-1770936)
 * Hello graymerica,
 * nice find. I had the same problem. But the above wasn’t working.
 * I had to use a more difficult way how to obtain current time respecting the WP
   time zone. I also had to switch the timezone from UTC-5 to “New York”, date_default_timezone_set
   wasn’t working with just UTC-5.
 *     ```
       function dateValid($date,$type){
         $date = mysql2date('U',$date,false);
   
         /// Addition
         $tz = get_option('timezone_string');
         date_default_timezone_set( $tz );
         $datetime = new DateTime( date('Y-m-d H:i:s') );
         $offset = $datetime->getOffset();
         $time = $datetime->format('U');
         $time = (int)$time + (int)$offset;
         //echo '<!-- COMMENT: '.$date.' server: '.$time.' -->';
         date_default_timezone_set('UTC');
         //echo ($date-$time);
         /// End of addition
   
         $editablecomments = get_option('editable-comments');
         if($type == 'edit')
           $minutes = $editablecomments['minutes'];
         if($type == 'delete')
           $minutes = $editablecomments['deleteminutes'];
         ///  Modification
         //if($date >= time() - $minutes * 60)
         if($date >= $time - $minutes * 60)
         ///
           return true;
   
         return false;
       }
       ```
   
 * Other than that, the “Comment updated” message is not showing up in the Thesis.
   And it also could be more secure. If you post a comment, everybody from the same
   IP will be able to edit it, it should probably check the WP commenting cookie
   at least.
 * Thanks,
    Martin

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Editable Comments] issue with timezone offset’ is closed to 
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/editable-comments.svg)
 * [Editable Comments](https://wordpress.org/plugins/editable-comments/)
 * [Support Threads](https://wordpress.org/support/plugin/editable-comments/)
 * [Active Topics](https://wordpress.org/support/plugin/editable-comments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/editable-comments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/editable-comments/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [FolioVision](https://wordpress.org/support/users/foliovision/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-editable-comments-issue-with-timezone-offset/#post-1770936)
 * Status: not resolved