Tag Archives: Plugins

Fixing Now-Reading’s Admin Menu

I like using Now-Reading to track what books I’m currently reading, have read and want to read on my website. Unfortunately the plugin’s author has been too busy of late to update the plugin and one of the recent updates to WordPress caused Now-Reading’s admin menu to break (when using the single menu option). PHP is not a programming language that I’m really familiar with but I did some poking around in Now-Reading’s code and found if I changed this snip of code:

	if ( $options['menuLayout'] == NR_MENU_SINGLE ) {

		add_menu_page('Now Reading', 'Now Reading', 9, 'admin.php?page=add_book', 'now_reading_add');

		

		add_submenu_page('admin.php?page=add_book', 'Add a Book', 'Add a Book',$nr_level , 'add_book', 'now_reading_add');

		add_submenu_page('admin.php?page=add_book', 'Manage Books', 'Manage Books', $nr_level, 'manage_books', 'nr_manage');

		add_submenu_page('admin.php?page=add_book', 'Options', 'Options', 9, 'nr_options', 'nr_options');

To read like this:

	if ( $options['menuLayout'] == NR_MENU_SINGLE ) {

		add_menu_page('Now Reading', 'Now Reading', 9, 'add_book', 'now_reading_add');
		
		add_submenu_page('add_book', 'Add a Book', 'Add a Book',$nr_level , 'add_book', 'now_reading_add');
		add_submenu_page('add_book', 'Manage Books', 'Manage Books', $nr_level, 'manage_books', 'nr_manage');
		add_submenu_page('add_book', 'Options', 'Options', 9, 'nr_options', 'nr_options');

Then Now-Reading’s single admin menu worked properly again.

XBMC-Hulu Update

I’ve been using the Hulu plugin now for a few days and it’s great but I do run into the occasional problem.  So I’ve been following the thread over at XBMC Forums about it as the plugin is under active development.  In a recent post to that thread, one of the developers said:

Please use the google addons.
Right now google addons is more in sync.

Sometimes I use my personal googlecode just to back stuff up, or sync it between my home computer and the one at work. Anytime I’m ready for you guys to try something out I’ll just stick it in the google addons svn & if it’s broken I’ll just revert it.

Which is a good tip as the thread has links to a wide variety of versions of the plugin scattered throughout its 45 pages.  Unfortunately the tip does not really clear things up in my particular case.  As I stated previously I’m using a copy of the plugin from xbmc-hulu. The developer who made the above comment is recommending people use the version of the plugin from xbmc-addons instead of his personal version at rwparris2-xbmc-plugins but makes no mention of the version at xbmc-hulu which shows that developer’s username as one of the project owners.

Bah.

I suppose I’ll just have to download the xbmc-addons version of the hulu plugin, try it out and compare it to the xbmc-hulu version.  As soon as I’ve had a moment to do so, I’ll post my results.

UPDATE: I’m not seeing any difference between the xbmc-addons & xbmc-hulu versions so far.  However after reading the thread on XBMC Forums, I did go through the trouble of configuring the plugin (under the XBox version -> Videos -> Plugins -> Hulu -> press the white button on your controller).  Setting a default video quality makes using the plugin much nicer (cuts out 2-3 button presses when trying to watch a specific video).  You can enter your Hulu account username/password but there doesn’t appear to be a benefit to doing so yet.

UPDATE2:Per the XBMC Forums, xbmc-hulu has been removed in favor the version available via XBMC SVN Repo Installer and the SVN Repo Installer pulls from xbmc-addons.

UPDATE: Per the XBMC-Hulu plugin release thread, there is no currently working version of the plugin.

Testing… 1…

I recently added a couple of plugins to this site (and a friend’s that I maintain) to try making administrating them easier.  Both sites also happen to use a plugin to crosspost to LiveJournal and now things are acting flaky.

I’ve disabled the most likely culprit and now am writing this post to see if I’m right about which plugin is causing the problem.  Wish me luck.

Side note: Our snowblower stopped working during the last snow-storm.  The engine runs, but the auger stopped turning.  This weekend we got a bunch more snow, so I opened up the snowblower, figured out what the problem was and fixed it.  I fought the snowblower and I won!  🙂  Unfortunately while troubleshooting it, I also fought my vice-grips and the vice-grips won (I’ve got the blood blister and cuts to prove it).

UPDATE: My first guess was wrong but I’ve figured out which plugin is causing the problem and deactivated it. For the record, Referrer Detector & LiveJournal Crossposter do not play nice together.

Now-Reading Tweaks v2

Some time back, I tried to make Rob Miller’s Now-Reading plugin display who’s reading each book on the individual pages. But the PHP code I posted at that time didn’t work like I thought it did, my interests changed and I moved onto other things. Today I had a visitor stop by asking about my broken tweak. So I took another look at the code and I believe I’ve got something that works this time.

// Now-Reading Plugin: Get the display name of the book's reader
function mlm_book_reader( $echo=true ) {
	global $book;

	$user_info = get_userdata($book->reader);
	
	if ( $echo )
		echo $user_info->display_name;
	return $user_info->display_name;
		
}

This grabs “Display name publicly as” from the user’s profile and displays it on the page. I put the function in the functions.php file of the theme I’m using (so any automatic upgrades of the plugin won’t erase it). Then I put < ?php mlm_book_reader() ?> into my custom single.php template and viola!

Note: this has only been tested on WordPress 2.6.2 with Now-Reading 4.4.3.

Now-Reading: Default Filters on Book-Meta

Ever since upgrading to the latest version of Rob Miller’s Now-Reading plugin, I noticed my single book pages were working but not displaying everything correctly. Specifically books I’d marked having been borrowed from my local library were being displayed as:

  • I borrowed this book fromlibrary

When they should simply have a line reading “I borrowed this book from my local library”. I had spent much
time fiddling with my templates trying to figure out how the upgrade broke them and today I figured it out. The truth is my template was just fine. The problem is the newer version of Now-Reading was applying a new filter to book-meta1. That filter is wpautop and it was wrapping my variable in <p> … </p> tags. Those tags screwed up the display and made my variable checks fail. To correct the problem, I went into now-reading/default-filters.php and commented out add_filter('book_meta_val', 'wpautop');. Now my single book pages look like they’re supposed to again. Yeah!

1 This is a custom field available in the back-end of the plugin and it is where I store the information telling my template if I borrowed the book and from whom I borrowed it.

Copyright © 2004 – 2018 CoffeeBear.net. Powered by WordPress.