{review_type}_reviews_default_order
Filter the default user and editor reviews order within a listing.
You need to have a working knowledge of Hooks before you get started.
When using the filter, replace the {review_type}
placeholder with user
or editor
.
Allowed order values are those that can be set using the Default Ordering
setting for reviews.
Order Value | Description |
---|---|
rdate | Most recent |
date | Oldest |
rating | Most positive |
rrating | Most critical |
updated | Last updated |
helpful | Most helpful |
rhelpful | Least helpful |
discussed | Most discussed |
Parameters
Name | Type | Description |
---|---|---|
$order |
parameter |
(string) |
$listing |
parameter |
(array) |
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Filter::add('review_type_reviews_default_order', function($order, $listing)
{
// Uncomment line below to view available data passed into hook
// fwd_dd($order, $listing);
return $order;
});
Examples
Change default ordering of editor reviews to most positive
With this filter you can have a different default orderings for editor and user reviews and reviews. Set the default order via settings for user reviews, and change the order of editor reviews using the filter.
Clickfwd\Hook\Filter::add('editor_reviews_default_order', function($order, $listing) {
return 'rating';
});
Source Files
/controllers/com_content_controller.php
/controllers/listings_controller.php