Reading on hold

So I’ve been using the Now Reading plugin for a while, but there was one feature I wanted: an “on hold” status so that if I am in the middle of reading a book but stop for a while, I don’t have to mark it as “Currently Reading” or as “Yet to Read” (the two non-complete statuses). So, I added the “On Hold” feature yesterday. It was pretty simple (modify two files and run one SQL query). Here’s the file changes:

in now-reading.php around line 36:

  1. $nr_statuses = array(
  2.         ‘unread’        => __(‘Yet to read’, NRTD),
  3.         ‘onhold’        => __(‘On Hold’, NRTD),
  4. +       ‘reading’      => __(‘Currently reading’, NRTD),
  5.         ‘read’    => __(‘Finished’, NRTD)
  6. );

and line 340:

  1. case ‘unread’:
  2.         case ‘reading’:
  3.         case ‘read’:
  4. +       case ‘onhold’:
  5.                 break;
  6.         default:
  7.                 $status = ‘all’;

Then, in template-functions.php, around line 130:

  1. function book_status ( $echo = true, $unread = , $reading = , $read = ) {
  2.         global $book, $nr_statuses;+   $text = $nr_statuses[$book->status];
  3. +       /*
  4.         if ( empty($unread) )
  5.                 $unread = $nr_statuses['unread'];
  6.         if ( empty($readin) )
  7.                 $reading = $nr_statuses['reading'];
  8.         if ( empty($read) )
  9.                 $read = $nr_statuses['read'];
  10.         switch ( $book->status ) {
  11.                 case ‘unread’:
  12.                         $text = $unread;
  13.                         break;
  14.                 case ‘reading’:
  15.                         $text = $reading;
  16.                         break;
  17.                 case ‘read’:
  18.                         $text = $read;
  19.                         break;
  20.                 default:
  21.                         return;
  22. @       } */
  23.         if ( $echo )

Finally, run this query through your favorite MySQL interface (phpMyAdmin):

MySQL [Show Plain Code]:
  1. ALTER TABLE `wp_now_reading` CHANGE `b_status` `b_status` VARCHAR( 8 ) NOT NULL DEFAULT ‘read’;

And presto, an “on hold” status that removes the book from the library’s public lists, while keeping it in the manage books section.

2 Responses to “Reading on hold”


  1. 1 rob

    Lovely stuff! I made a couple of modifications (like still allowing the overriding of message text in `book_status()`, but it’s now in SVN and will be in the next release of Now Reading.

    Thanks!

  2. 2 christopher

    Sweet. I’m also finishing up a K2-compatible set of templates . I’ve also made the NR widget into a Sidebar Module (for easier use in K2). I’ll post those soon as well.

Leave a Reply