From 13fa0d7dba4e3b2cc621e1448149be29ba56f146 Mon Sep 17 00:00:00 2001 From: Ian Isted Date: Mon, 15 Sep 2014 17:14:18 +0100 Subject: [PATCH] Revert "Added order parameter" This reverts commit ed1d28147c4b7703ad7f2f69ab942dd40b3d3b20. --- README.md | 56 ++----------------------- bookworm/BookwormPlugin.php | 2 +- bookworm/variables/BookwormVariable.php | 9 ---- 3 files changed, 4 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 8004965..843fc58 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Pull lists of books directly into your Craft templates. To install Bookworm, copy the bookworm/ folder into craft/plugins/, then goto Settings > Plugins and click **Install**. -You will then need to enter your Goodreads User ID. This can be found in the address bar when viewing your Goodreads shelves. It's the seven digit number listed after _/list/_ +You will then need to enter your Goodreads User ID. This can be found in the address bar when viewing your Goodreads shelves. It’s the seven digit number listed after _/list/_ E.g. @@ -40,63 +40,13 @@ In your template add the following line to pull a list from Bookworm. This will You can also define optional parameters to change the results you get back. ``` -{% set books = craft.bookworm.fetch({'shelf': 'to-read','limit': 200,'sortBy': 'date_read'}) %} +{% set books = craft.bookworm.fetch({'shelf': ‘to-read','limit': 200,'sortBy': 'date_read'}) %} ``` -### shelf - -Used: ` 'shelf': 'to-read' ` - -This can be any public shelf in your Goodreads profile - -Default shelves are: - -- read -- currently-reading -- to-read - -### limit - -Used: ` 'limit': 100 ` - -This is the number of books to fetch. - -*Please note, there seems to be a limit of 200 books that can be retrieved from the Goodreads feeds.* - -### sortBy - -Used: ` 'sortBy': 'date_read' ` - -Options include: - -- author -- date_read -- date_added -- date_started -- read_count -- title -- rating - -### order - -Used: ` 'order': 'asc' ` - -Books that have been retrieved are in descending order by default. You can reverse the order using this parameter. - -*Please note: Unfortunately Goodreads will not provide the feed in an ascending order. So we can only reorder the results once we have them.* - -*This means for example that if you have more than 200 books in a shelf, sort by title, and order ascending, you may miss books at the beginning of the alphabet.* - - +Please note, there seems to be a limit of 200 books that can be retrieved from the Goodreads feeds. ## Changelog - -### 1.0.2 - -- Added order parameter (you can now order your results in ascending order) -- Updated README - ### 1.0.1 - API key is now optional diff --git a/bookworm/BookwormPlugin.php b/bookworm/BookwormPlugin.php index 17ad9db..648de80 100644 --- a/bookworm/BookwormPlugin.php +++ b/bookworm/BookwormPlugin.php @@ -18,7 +18,7 @@ function getName() function getVersion() { - return '1.0.2'; + return '1.0'; } function getDeveloper() diff --git a/bookworm/variables/BookwormVariable.php b/bookworm/variables/BookwormVariable.php index ce8f337..e008ad9 100644 --- a/bookworm/variables/BookwormVariable.php +++ b/bookworm/variables/BookwormVariable.php @@ -31,7 +31,6 @@ public function fetch($options = NULL) $shelf = (isset($options['shelf']) ? $options['shelf'] : 'read'); $limit = (isset($options['limit']) ? $options['limit'] : '10'); $sortBy = (isset($options['sortBy']) ? $options['sortBy'] : 'date_read'); - $order = (isset($options['order']) ? $options['order'] : 'desc'); if ($userID === "") { @@ -66,15 +65,7 @@ public function fetch($options = NULL) } if (count($books) > 0) { - // Check if order is set to ascending. If it is, reverse the array, otherwise carry on. - - if ($order == "asc") { - $books = array_reverse($books); - } - - // Everything seems to have worked, send the books to the template. - return $books; } else { $error = "No books could be found. Are your settings correct?
Feed url: $feed_url";