bu-ist / bu-versions

Make and save edits to published posts/pages in WordPress without immediately replacing the public content.
https://developer.bu.edu/bu-versions/
19 stars 5 forks source link

Innaccurate information is being displayed when previewing draft posts. #27

Closed desrosj closed 7 years ago

desrosj commented 7 years ago

This change is fixing the issue for me on NM. I would love some input from someone who knows this plugin more intimately to confirm this won't cause any issues.

Related issue: #26.

desrosj commented 7 years ago

When a $version_id is not supplied as a query argument, it is turning into 0 after being type casted as an integer. This is causing some issues with wp_get_post_autosave(), which is returning a somewhat random revision (I believe it is either a revision for the latest post retrieved, or the latest revision overall).

inderpreet99 commented 7 years ago

This fix looks good to me.

Note: Other sites with the BU Versions plugin are properly adding in the version_id to make this work. For some reason, the Abroad site is not making it happen. Hence, it just picks up a random (BU Slideshow) revision from the DB. It's worth investigating why this happens in the future.

desrosj commented 7 years ago

@inderpreet99 I will leave #26 open as an issue after we merge this to continue investigating.