New Blog Feature – Now Reading….

I’d decided to install Rob Miller’s “Now Reading…” version 4.0 plugin ages ago to replace my Read in 2005 and 2006 categories. But I knew there was a new version of my current theme out. So, it didn’t make sense for me to manually add the required template changes especially when the new version of Binary Blue supported Widgets and writing a Now Reading Widget woud be simpler than updating the template all the time. Skip a few months and now Rob himself has investigated widgets and made his own available for Now Reading. So I rushed over to his site, grabbed it and installed it right away! S0000 SWEEET!

Unfortunately, my excitement got the better of me. I failed to notice that the download page for Now Reading had, not only the widget available, but also an updated version of the plug in. The current version of Now Reading was 4.2 and installing the plug in with 4.0 caused the side bar to blow up with a missing function error. I realized my probably mistake right away, uninstalled it all and reinstalled in the correct order with the latest.

Unfortunately, my woes did not end there. I found three problems with 4.2 that could be fixed with relative ease. The first problem was a ” *Fatal error*: Cannot redeclare now_reading_add()” Error. That was very easy to find. I had one link that didn’t work and one link for the same page that did work. A quick change to make now-reading-admin.php always use the “post.php?page=now-reading-add.php” syntax instead of “post.php?page=now-reading/now-reading-add.php” and the problem was solved.

The next problem was a “1 book *Warning*: Cannot modify header information -” error message that came up each time I edited a book. That looked just like a debug comment, and indeed Rob confirmed that this one was fixed in his own code already but didn’t say how. I didn’t have access to check out the latest code yesterday, so I fixed it myself. The total_books routine takes a parameter to termine whether or not to print to the screen. In one place, the parameter was needed but not specified. So I changed
if ( $count > total_books(0) )
to:
if ( $count > total_books(0, false) )

and that problem was solved.

I sent those two changes and a recommendation that the widget check for the correct version of the plugin to him and he replied with a thanks, he’d put in the changed the code as I’d suggested (b4 or after I don’t know) and notice that 4.21 was released! Cool, that means no one else should get these errors.

Unfortunately, I noticed two minor things after that point. First, one book I entered had an apostrophe in the title. Unfortunately, the plugin now put a slash in front of the appostrophe. I SUSPECT that this is a WP 2.03 issue and I have not reported it to Rob. I’ll install 2.04alpha/beta/whatever soon and see if the problem goes away.

The next minor issue was reported to Rob with the fix. After I put in the 12 books I read this year, the plugin was reporting that I had an average of 144 books a month. I admit that my 2 books* a month average this year is pathetic compared to last year’s 3.6 (I read nothing in March this year oddly enough – I guess that’s when I started the blog and nothing struck me as interesting enough to take my time away from that. And I’ve also been reading a lot from Orson Scott Card’s Intergalactic Medicine Show), but I’m not going to bolster it to 144 books a month…

So, I dug into the average query and found the problem…

I shot another email to Rob just before two this morning:

>I’ll add a version check to the widget now, good idea.
Thanks!

Oh and I have one more update if you haven’t fixed this one already too..

Your average books calculation was off. You’re missing a MIN statement around the b_added.

So it should look like this:
SELECT
( COUNT(*) / ( TO_DAYS(CURDATE()) – TO_DAYS( MIN(b_added) ) ) ) AS books_per_day
FROM
{$wpdb->prefix}now_reading
WHERE
b_status = ‘read’

Nice plugin… Now I’m just trying to remember all of the books I’ve read so far this year… I just remembered another… So that’s 12…

That change is in template-functions.php around line 145. I think I’ll keep my current version installed till the fix is out.

So, now you can look at my sidebar now and see all of the books I am reading and have read this year. And if you like the idea of any of the books I’ve read, you can purchase it through the links and I’ll get a peice of the action. (Actually for now Rob will. I’ve not put in my own Amazon ID yet.) I don’t think I’ll put in last year’s 44+ books for a while yet. Each book deserves a comment but that’s 44 more blog entries I need to write. So, I’ll piece meal them in. If you like what you see, please visit Rob’s site and download the latest and greatest versions of now reading. Just click this link: http://robm.me.uk/projects/plugins/wordpress/now-reading/

BTW, I put together the promised context menu post I mentioned the other day, but was debugging something and decided to backup the file and wipe out most of the file so that I could Isolate what I was debugging. Unfortuately, I forgot I’d also already changed the name of the working file. *smacks head* So, I lost some of my change and all of my extended commenting. I just need to re-review the comments ( the second time you put in comments they are never as good as the first time you put them in ) and I’ll publish the post. Probably tomorrow. I’ve got a lawn to mow and a carpet or two to shampoo… Cheers!

* One of the people in our shipping department had a discussion with the UPS guy saying both stated that they’d each only ever read 1 book cover to cover. How sad (not not meaning pitiful but saddening) is that…

2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *