As the name implies, file overrides allow replacing an entire file with a customized version. This is the approach used for templates, and it also works with PHP files.
Overview
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.
While overriding an entire file provides lots of flexibility in the changes you can make, it's preferable, whenever possible, to use one of the other development tools (hooks, events, and macros), because these are easier to maintain.
Getting Started
You can override practically any PHP file in JReviews and Add-ons by copying the file to overrides using the same file structure found in the source.
The PHP overrides work just like the template overrides and view helper overrides.
Below you can find some examples of the original files on the left, and the corresponding override on the right.
For Joomla, the left hand-side starts at components/com_jreviews
, while for WordPress it's wp-content/plugins/jreviews
.
Source
jreviews/
`-- controllers/
| `-- categories_controller.php
`-- models/
`-- media.php
Overrides
jreviews_overrides/
`-- controllers/
| `-- categories_controller.php
`-- models/
`-- media.php
Clear Cache & File Registry
Clear the registry in the JReviews admin CP after creating new files in overrides.
Disabling Overrides
For troubleshooting purposes after making changes, or after an update, you can prevent JReviews from loading any of the code in overrides and instead use the core files. You can find the Disable Overrides
setting in Configuration Settings → General
.
Dealing With Customizations After Updates
To find out what you need to know about dealing with customizations after updates, read There's an update - Now what?.