Allow ordering by favorites in searches
This commit is contained in:
parent
6a248a0a5c
commit
4b086a8c70
1 changed files with 4 additions and 0 deletions
|
@ -133,6 +133,10 @@ class Favorites extends Extension
|
|||
} elseif (preg_match("/^favorited_by_userno[=|:](\d+)$/i", $event->term, $matches)) {
|
||||
$user_id = int_escape($matches[1]);
|
||||
$event->add_querylet(new Querylet("images.id IN (SELECT image_id FROM user_favorites WHERE user_id = $user_id)"));
|
||||
} elseif (preg_match("/^order[=|:](favorites)(?:_(desc|asc))?$/i", $event->term, $matches)) {
|
||||
$default_order_for_column = "DESC";
|
||||
$sort = isset($matches[2]) ? strtoupper($matches[2]) : $default_order_for_column;
|
||||
$event->order = "images.favorites $sort";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue