{review_type}_reviews_default_order

Filter Hook Reviews Since 3.7.4

Filter the default user and editor reviews order within a listing.

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

$order

(string)

$listing

(array)

You need to have a working knowledge of Hooks before you get started.

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
  // For JReviews 3.x and earlier use dd instead of fwd_dd
  // fwd_dd($order, $listing);
  
  return $order;
});
Development & Support
Customizations are not included with support. We provide this information to make it easier for developers to extend the functionality. From time to time we may have some availability for custom work. Get in touch to see if there's an opportunity to work together.

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

  • /controllers/com_content_controller.php
  • /controllers/listings_controller.php