Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Resolve problems pushing to and pulling from Story API #60

Merged
merged 10 commits into from
Sep 27, 2018

Conversation

benlk
Copy link
Contributor

@benlk benlk commented Sep 26, 2018

Changes

This is a wrap-up of miscellaneous errors noticed when diagnosing problems pushing to the API, documented in #57.

  • Fixes issue where action used to push posts to the API was not running, because of a missed spot in Revisions to the NPR API editor meta box #47 identified in Problems pushing content to the API #57
  • Fixes issue where images were not properly sideloaded when pulling from the API, identified in Problems pulling images from the API #59
  • Removes duplicate <hr/> seen in the query-based fetch settings page "NPR API Get Multi", which was between the "Publish Stories X" and "Add Tags X" settings.
  • Fixes an "undefined offset" PHP notice that occurred when attempting to delete a post from the API when the post had no API ID.
  • Fixes an "undefined variable" PHP notice that occurs when loading the "Get NPR Stories" page without a post specified
  • Fixes a "Non-static method DS_NPR_API::load_page_hook() should not be called statically" PHP notice that appears on the "Get NPR Stories" page — because the method was hooked incorrectly. And changes a test to match.
  • Fixes an "Uncaught Error: Cannot use string offset as an array" error in the plugin settings page when checking API permissions. Problems pushing content to the API #57 (comment)

Why

Prevents a couple issues when pushing or pulling posts from the API.

> PHP Notice:  Undefined offset: 0 in /Users/blk/sites/nprapi/wp-content/plugins/nprapi-wordpress/push_story.php on line 99

Seen during GET /wp-admin/post.php?post=6&action=trash&_wpnonce=5b73650f23
This fixes the issue described in #57, where the URL parameter ds_npr_update_push was removed along with the 'Push to NPR' submit button, but the URL parameter triggering the nprstory_api_push function was not changed.
> PHP Notice:  Undefined variable: story_id in /Users/blk/sites/nprapi/wp-content/plugins/nprapi-wordpress/get_stories.php on line 132

Caused by running is_numeric on a variable that isn't set.
…called statically

Just had to change how the hook was registered, that's all.
@benlk benlk added the bug label Sep 26, 2018
@benlk benlk added this to the 1.8 milestone Sep 26, 2018
@benlk benlk self-assigned this Sep 26, 2018
@eteare eteare merged commit 8e94f98 into master Sep 27, 2018
@scottsmith130 scottsmith130 deleted the 57-58-problems-pushing-pulling-to-from-api branch October 1, 2018 20:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants