npr / nprapi-wordpress

Access the NPR API from within WordPress. This repository is no longer being maintained. See the README for more information.
GNU General Public License v2.0
13 stars 30 forks source link

When site has no GMT offset saved, the expiry datetime causes problems #52

Closed benlk closed 6 years ago

benlk commented 6 years ago

When the 'gmt_offset' value is a number (which is pretty much everywhen), the DateTimeZone constructor complains that the number is not a valid timezone.

https://github.com/npr/nprapi-wordpress/blob/853a3011aafa9727a8742111305ff3194abca236/push_story.php#L676-L679

PHP Fatal Error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (-4)' in /plugins/npr-story-api/psuh_story.php:676'

benlk commented 6 years ago

Timezones are not a specific GMT offset; we need a GMT offset for this. A better approach is described in https://github.com/npr/nprapi-wordpress/pull/53 that makes use of WordPress's tools for converting timezones to GMT offsets.

kaylima commented 6 years ago

TODO: Up to 2 hours for remaining testing for #53 .

benlk commented 6 years ago

Automated tests for #53 pass.

Human-run tests for #53 should perform the following tasks:

  1. Activate the plugin
  2. Configure the plugin with test API credentials
  3. Create a new post.
    1. Does the NPR Story API meta box appear on the page?
    2. Are there no errors in the server console?
    3. Change the time zone in Dashboard > Settings > General to a new time zone. Repeat step 3 until satisfied.
  4. Push a post to the API.
  5. Pull a post from the API.