christiespeich / Mooberry-Book-Manager

An easy-to-use system for authors to add books their Wordpress website
GNU General Public License v2.0
3 stars 1 forks source link

Future published dates don't show on book pages #38

Closed jmihalik closed 6 years ago

jmihalik commented 6 years ago

Hello! Thanks for the awesome plugin! One issue I'm having is that books with future published dates don't show the "Available on" label on their book pages. I think I've tracked down the issues, but I'd prefer not to change my local files so I can still update. And I'm no expert, so my changes might break something else. :)

I think it's two issues. The first: In class-mbm-book-basic.php, line 129, a book with a future date will never return true for is_published, meaning the date will never show because line 2359 of class-mbm-book-cpt.php checks is_published before adding the book_published shortcode.

Issue two is with the book_published shortcode itself. On line 1612 of class-mbm-book-cpt.php in the shortcode_published function, I believe $this->data_object->release_date needs to be wrapped in strtotime() to correctly compare against strtotime('now').

You should be able to easily test/reproduce the issue by setting a future published date for a book and then checking the book page to see if the "Available on:" label is showing up. Please let me know if you have any questions!

christiespeich commented 6 years ago

Thank you for your stellar debugging! You are right on both counts. I have no idea how this bug went unnoticed for so long, but I'm pushing the update out now!