I Gutted My Database to Create a Better Book Review System

Confession: Nose Graze has never used the Ultimate Book Blogger plugin. That’s because the creation went like this:

  1. Start the Nose Graze blog.
  2. Build my own system for formatting book reviews and archives using Advanced Custom Fields. I literally did this on day one of my blog.
  3. …a year passes…
  4. I think, “Hey, maybe other people would like this too!” But my system wasn’t able to be redistributed as-is, so I coded something new (Ultimate Book Blogger plugin).

And I simply never moved Nose Graze over because that was a big migration project I wasn’t really interested in doing. My system already worked.

I finally decided to code myself a better system

This project didn’t actually start out as, “I want to code a better system for Nose Graze.” It started out as purely a hypothetical project: “What would Ultimate Book Blogger look like today if I could rebuild it?” So this was my fun project for a hypothetical “UBB do-over”. I wasn’t even really planning on using it in the end (then what was I doing it for? IDK), but I loved it and decided to move Nose Graze over to it.

Migrating reviews to the Book Database plugin

In the end, this project stopped being a hypothetical re-coding of UBB, and just became a super simple plugin that I wanted to use on my own site. The final result is really not like UBB at all.

So what is it exactly?

Before I dig into details, I want to make something clear: I still don’t know what this plugin is.

I know it’s something I’m now using on Nose Graze and will continue to use, but I think the big question is: will UBB go in this direction? And to that, I don’t know. I will talk a bit about this at the end.

For now, just consider this me showing off my own new system and you’re welcome to tell me what you think. πŸ˜›

Before

As I said before, Nose Graze used to use Advanced Custom Fields. A form like this appeared on the Edit Post page:

Advanced Custom Fields form for book information

I also had taxonomies for author, publisher, genre, etc.

But now….

Books and reviews

My new plugin no longer binds reviews (and book info) to posts. Instead, there are new areas in the admin panel: one for books and one for reviews.

I can add a book, fill out the book information, display that information in a post, and create a review of that book.

Books and reviews are kept separate, but you can link a review to a book. This separate system allows me to also add a book’s details to a post without needing a review if I don’t want one.

Reviews can be associated with blog posts or lead to an external URL

This is something that has been widely requested in UBB but just didn’t really work within the current system.

When adding a review in my new plugin, I basically choose a ‘source’ for the review:

The ID of a blog post (if the review is on my blog).
or:
I can enter any other URL of my choosing (like to my Goodreads review).

Then in my review archive, the review will either link to the blog post or that external URL.

A better, more compressed UI

One of the worst things about UBB is the cluttered interface for adding a book. The book information is a combination of post meta, which appears in the main meta box area, and taxonomies, which are shoved off to the right. See below:

Book information form in the Ultimate Book Blogger plugin

This separation is disjointing, especially to new users.

It was the same with my ACF method on Nose Graze. The ACF box was in the middle and taxonomies were on the right.

In my new plugin, everything is custom coded, which gives me a lot of flexibility in how I display the book information. I can group things together more logically (like the series name and series number can be right next to each other).

Page for editing a book

Adding a book review from a blog post

This process is pretty awesome. I drew a lot of inspiration from the WP Recipe Maker plugin.

There’s a new button above the editor for “Insert Book”.

Insert book button above the post editor

Clicking this brings up a modal like the “Add Media” one.

Modal for adding a book to the post editor

You can either search for an existing book or add a brand new one.

After clicking “Insert”, the book gets created and a new shortcode is added to the post editor. But the shortcode looks like this (visual editor only):

Book shortcode in the visual editor

If you click on the book info box, it opens the modal back up with that book information already loaded in, so you can easily edit that book.

Book modal with "Shuffle, Repeat" loaded in

It’s a few more steps to actually turn that into a review because I didn’t integrate the review part with the modal. I probably could have, but it got more complicated and I lost motivation since I don’t actually use the visual editor anyway.

So to add a review, there’s a separate box below the editor for “Book Reviews”. I click “Add Review”, select which book it’s for, choose my rating, and press “add”. This creates the new review entry and associates it with the post.

Meta box for associating a review with a post

This is definitely something I’d like to bring over to UBB. It’s just plain awesome.

Searchable review archive

The only big change that readers will see on my site is the new review archive. Let’s look at a little before and after:

Before:

  • All reviews listed on one page (like this — I did actually still keep this for funsies).
  • Separate pages/shortcodes for reviews by title, reviews by author, reviews by series, etc.

After:

  • Reviews are split up into paginated results.
  • There’s only ONE archive, but that one archive has a form for filtering where you can narrow/change the results.
Review archive with filtering options

A huge problem with UBB is people having thousands of reviews and then running out of memory to display them all on a page. This is partly because of how book info is added to posts via post meta, and it’s just a bit convoluted. This new display breaks the results up into multiple pages, but also has pretty awesome searching/filtering.

Cool admin analytics

This one is exciting! For this I drew a lot of UI inspiration from EDD Metrics.

Reading and review analytics for 2016

I even added a system where I can log how many times I’ve read a book to track re-reads. Sadly those numbers are pretty inaccurate right now since I only just added it so it only has my re-reads from November, but I’m excited to see the data moving forward!

Under the hood: it’s a lot of custom code (and custom database tables)

From the get-go, I had two goals:

  1. Use fewer (if any) third party libraries.
  2. Use custom database tables.

I wanted #1 because I used a few third party libraries in UBB (like CMB2) and they ended up making my life a lot harder down the road. I have nothing against CMB2 and think it’s great for the right person and right product, but with UBB it started being more of a hindrance than anything else.

And I wanted #2 for a few reasons.. Most people would probably gravitate towards custom post types (one for ‘Books’ and one for ‘Reviews’) and while I totally get that approach, I ultimately decided against it. I just really wanted to build this plugin into something that scales really well (thousands and thousands of books), and I wanted the data to be easy to manipulate and fast to query. I ended up needing to replicate a lot of core code to work with my custom tables, but in the end it’s working in a way that’s 100% perfect for my project.

How can this be integrated into UBB?

This new plugin really focuses on three things:

  1. Display book information in blog posts.
  2. Maintain an archive of reviews (with filters).
  3. See interesting statistics about the books you read and review.

UBB does a ton of other stuff, which is why I guess the two plugins are totally separate for now. This new plugin has no widgets, only like four settings, no giveaway/blog tour/blogroll support, no “fetch info from x site”, no related posts, no about the author boxes… But I do think I can draw a lot of inspiration from this new plugin as I move forward with UBB.


Also, this post is called “I gutted my database..” because I deleted my old data, which ended up being 25,086 rows from the postmeta table and 2,871 taxonomy-related rows. SpringWinter cleaning!

So what do you think? Pretty cool?

P.S. Carina just released her 2017 book spreadsheet, which also has a lot of cool reading statistics! Check it out if you’re into spreadsheets and stats.

Photo of Ashley
I'm a 27 year old California girl living in England (I fell in love with a Brit!). I like to inject a little #girlpower into the WordPress development community by teaching women how to be coding badasses. more »

Don't miss my next post!

Sign up to get my blog posts sent directly to your inbox (plus exclusive store discounts!).

You might like these

Leave a Reply

(Enter your URL then click here to include a link to one of your blog posts.)

25 comments

  1. Ah! I love this! This is pretty much the only thing I use UBB for. I never use all the extras. I’ve played with them before, but I ended up deciding they were too much work. I just want to write about books and be done with it. This looks awesome, Ashley.

    1. Thanks Laura! I think that’s partially why I never tried to get my site over to UBB. I knew I wasn’t going to use so many of the features.

      So now I guess I have to figure out if this new plugin is something I want to move forward with, or try to integrate into UBB, or what… tough decisions!!

    1. Sadly I don’t really know yet! There are several directions I could take here and I’m really struggling to figure out what the “right”/best move is. Even if this became an add-on, so much of UBB (and the existing add-ons) would need to be re-coded to handle it, which is a pretty huge undertaking. I guess I just need more time to figure out how to move forward!

  2. I LOVE IT! I have wanted to be able to have one place for book info where I could go for reviews, highlights, blog posts etc ALSO I love the Archive Review! I hope at some point these can be integrated into UBB. Great job! I admire your creativity, ideas and talent.

    1. Thank you Angela!! I’m really struggling with how to move forward with this. I figured a lot of people would be interested, but I need to figure out how this can be integrated into UBB, what kind of changes would need to be made, etc. UBB would need some pretty big re-coding, then data migration between versions, etc. It’s very very complicated and I guess I need to spend more time thinking about the best way to tackle this. πŸ™‚ Hopefully I can get it figured out!

  3. I absolutely love this! I think it would be a great standalone plugin and I could see myself using it instead of UBB. I love analytics and the adding book reviews to blog posts. I look forward to seeing where to you take this, Ashley.

    1. I’m glad you like it! πŸ™‚ I really need to sit down and figure out what to do with this plugin and how best to move forward.

      1) I could re-code UBB to be like this, plus build in all the other UBB features. Basically a giant re-coding of UBB.

      2) I could use this new plugin as the new “UBB base” and have an add-on that brings in other UBB features.

      3) Or I could keep them as two totally separate plugins, even though they do have overlap.

      I really don’t know what the best move here is and I guess I need more time to think it over!

  4. I really love the third option, Ashley! One of the things I absolutely love is looking at the stats and average ratings per genre etc. I also love the idea of separting books from posts since I don’t review all the books J read!

    If this becomes something that can be incorporated to UBB that would be super awesome!

    If this becomes another plugin that can be used in conjunction to UBB that would be awesome as well! I really love the other UBB options so I would love to keep those and I use them a LOT!

    I still love the option to import info from Goodreads/Google for the book info because it makes it super easy!

    I have made my own spreadsheet to track some of my stats! Haha

    1. I’ve definitely started reading more books without reviewing so I love that too! I actually created an entire “reading log” thing that I didn’t feature here, which allows me to:

      – Note that I read a book without rating or reviewing (but it appears in stats as a book read).
      – Note that I read a book AND rated it.
      – Note that I read a book, rated it, and reviewed it.

      Plus I can add multiple reading log entries for each book to help track re-reads.

      I guess I just really need to figure out exactly what this plugin is, and how it can be part of UBB. There are several directions I could take and it’s honestly really hard to figure out which one is the right/best move. I might just need a bit more time to think it over.

      1. Ohhhh yes! The re-read feature would be awesome! Goodreads doesn’t have that option and it really sucks because I re-read A LOT!

        Even if not all of the features get added to UBB, I hope the re-read counter feature makes it somehow! ☺️

        And your reading log is something that I also want, too!

  5. This looks amazing. I love all of it and would really love to have our review archive look like this! I also love the way the book info is separate from the reviews, kind of like how authors are put in differently in UBB. You’re amazing!

  6. Hallo Ashley!

    πŸ™‚ Love how your creative hive of a mind works out new innovative code designs & ways to make data look crisp and smart. Having said that – some of us who are using the UBB have customised it for our own needs along the way – custom fields/options to insert different kinds of data that works well with what we want to present on a book review. I was curious – if you migrate this new framework (baseline) into the current UBB would we be stripped of those features where we could effectively ‘custom’ the links routing to say WorldCat, LibraryThing or publishers – or other instances of where I’ve customised bits of the UBB for my own needs rather than the streamline version of what others might be using instead!?

    I do agree with you – we all need a system that *works for us!* first – meaning, a lot of what I have on my own blog is there because it’s how my own mind organises information and catalogues my bookish life. It’s an evolving process to better understand my own reading life whilst trying to encourage others to ‘try’ a #newtomeauthor for themselves based on what I’m reading.

    One thing I had to abandon outright was as the series & sequence option in the UBB; I used to say “Harry Potter, No.1” (for instance!) and nothing was threading properly. I reverted back to just using serial names and adding on the sequences myself in the extra data bits I add on my own. For instance, I add a link to the publisher and their Twitter handle; Formats available, etc. I never could sort out how to add those to the UBB database opts to make it more streamlined.

    I’ll try not to hyperventilate whilst you decide what your doing next — sometimes upgrades stress me out if their wicked confusing or completely overhaul something I’ve grown used to using. Having said that – I’ve made it this far with all prior upgrades and found my rhythm – I’ll continue to do so, as you make blogging wicked awesome! πŸ™‚ You rock code – I love watching how your mind works and seeing how code augments itself as your muse.

    1. If I decide to do anything that would involve removing UBB features then I would package it into a brand new plugin. So you could make the decision to stick with UBB or migrate to the new plugin. It would be your choice!

    1. Well if someone wanted to use it CURRENTLY alongside UBB then they’d have to enter book information twice (once in UBB and once in this plugin), which I imagine would be annoying. πŸ˜›

  7. I love this! One of the reasons I’m hesitant about UBB (financial complications aside; it’s just on my list of things I’d like, but in the “but…” column) is its bulkiness. I’m not totally a book blogger, but I do like reviewing books here and there, and I dislike having to type out everything every single time. I’m always going back to an older post and using it as a reference for all the labels. But I’d not use every single feature of UBB, and I don’t review everything on my blog. I like how this one you made allows you to list out your reviews and link to reviews elsewhere.

    1. Yeah I think the beauty of this plugin is it’s the core part of UBB without all the extra things. UBB has definitely grown a lot since it was first released, which some people appreciate, but some people are intimidated. I kind of regret letting UBB get as big as it’s gotten.

      1. This is such a late response (I guess I didn’t get an email notification), but I’m wondering if you know whether you might create a new plugin using this system (new, because I read a comment down below that you’d rather keep it a totally separate plugin) and make it available for people who want it.

        I ask, because I’m doing more book reviews now, and copy-and-pasting isn’t difficult, it’s just time-consuming, but would rather hold off buying UBB in the event that you might do this.

        (If that makes sense.)

        I just really like this one more. πŸ˜…

        1. Well I do have a copy of the new plugin I’m using here: https://github.com/nosegraze/book-database/archive/master.zip

          But things to consider:

          1. There’s no documentation.

          2. There are three pretty distinct parts of the plugin: books, reviews, and reading logs (so you can mark a book as having been read without necessarily reviewing it.. almost like Goodreads). It’s possible that the interface for these three connecting pieces isn’t great and only makes sense to me.

          3. I don’t currently have a system in place to provide support or updates for this plugin and I’m not sure if I ever will. I think one of the reasons I haven’t moved forward with this plugin in a more official way is because I’m not sure I want to put myself in a position to need to support it or add features other people may want that I don’t want. Right now the plugin is really tailored to what I want and need and I don’t know if I want to change that.

          So I guess what I’m trying to say is: use at your own risk. πŸ˜‰

          1. I will just invest in the plugin, then. πŸ˜‰ I did download and install it on a test installation, but I’d rather have one that’s supported and doesn’t require me to try to understand it. πŸ˜…

            (And UBB has other features I like, so. #worthit) I mostly just liked the grid-like view you have for this one and the ability to link to Goodreads instead of a post—but especially the grid-like view. ❀️

            I do appreciate the response regardless, though! Was nice to see a glimpse of what you can create.

  8. I like the idea of having admin analytics, but I LOVE how UBB uses taxonomies because it integrates perfectly with FacetWP, which is what I use for my archives. In fact, that’s the main thing I use UBB for. I don’t write a lot of traditional book reviews, but I do curate lots of book lists and I tag each list with all the relevant authors, publishers, etc. That integrates seamlessly with FacetWP and it makes my archives so much more navigable. If all of the book information were custom coded, I don’t think that would work. This integration is the cornerstone of how my site is organized, so I would be seriously bummed if that changed.

    1. Thanks for your feedback Kate. πŸ™‚

      I think that’s why I might rather keep this as a totally separate plugin from UBB and people can choose which one they want to use. πŸ™‚

      The downside of using taxonomies and custom fields is that you have a lot less flexibility and efficiency with querying books, getting data, and loading review archives.

Recent Posts

    Random Posts