Skip to content

Commit

Permalink
Revert "Added order parameter"
Browse files Browse the repository at this point in the history
This reverts commit ed1d281.
  • Loading branch information
mrnebbi committed Sep 15, 2014
1 parent ed1d281 commit 13fa0d7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 63 deletions.
56 changes: 3 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. Its the seven digit number listed after _/list/_

E.g.

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bookworm/BookwormPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getName()

function getVersion()
{
return '1.0.2';
return '1.0';
}

function getDeveloper()
Expand Down
9 changes: 0 additions & 9 deletions bookworm/variables/BookwormVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 === "") {

Expand Down Expand Up @@ -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?<br />Feed url: <a href='$feed_url' target='_blank' style='color:#000000 !important;'>$feed_url</a>";
Expand Down

0 comments on commit 13fa0d7

Please sign in to comment.