mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
BUGFIX: restored filtering by Author to the entries function
This commit is contained in:
parent
b066dce821
commit
3e952feefc
@ -199,7 +199,8 @@ class BlogTree extends Page {
|
|||||||
|
|
||||||
// By specifying a callback, you can alter the SQL, or sort on something other than date.
|
// By specifying a callback, you can alter the SQL, or sort on something other than date.
|
||||||
if($retrieveCallback) return call_user_func($retrieveCallback, 'BlogEntry', $filter, $limit, $order);
|
if($retrieveCallback) return call_user_func($retrieveCallback, 'BlogEntry', $filter, $limit, $order);
|
||||||
else return DataObject::get('BlogEntry', $filter, $order, '', $limit);
|
|
||||||
|
return DataObject::get('BlogEntry', $filter, $order, '', $limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +229,21 @@ class BlogTree_Controller extends Page_Controller {
|
|||||||
$filter = '';
|
$filter = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allow filtering by author field and some blogs have an authorID field which
|
||||||
|
// may allow filtering by id
|
||||||
|
if(isset($_GET['author']) && isset($_GET['authorID'])) {
|
||||||
|
$author = Convert::raw2sql($_GET['author']);
|
||||||
|
$id = Convert::raw2sql($_GET['authorID']);
|
||||||
|
|
||||||
|
$filter .= " \"BlogEntry\".\"Author\" LIKE '". $author . "' OR \"BlogEntry\".\"AuthorID\" = '". $id ."'";
|
||||||
|
}
|
||||||
|
else if(isset($_GET['author'])) {
|
||||||
|
$filter .= " \"BlogEntry\".\"Author\" LIKE '". Convert::raw2sql($_GET['author']) . "'";
|
||||||
|
}
|
||||||
|
else if(isset($_GET['authorID'])) {
|
||||||
|
$filter .= " \"BlogEntry\".\"AuthorID\" = '". Convert::raw2sql($_GET['authorID']). "'";
|
||||||
|
}
|
||||||
|
|
||||||
$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
|
$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
|
||||||
|
|
||||||
$date = $this->SelectedDate();
|
$date = $this->SelectedDate();
|
||||||
|
Loading…
Reference in New Issue
Block a user