Validate Leave
public function onValidateLeaveReview(string $type, int $id, object $user) : bool
Fires while checking whether the user is allowed to leave a review.
Description
Trigger hook to override the default system criteria used to evaluate whether a review should be left or not.
In case of the hook returns a positive value, the user will be allowed to leave a review. Otherwise, the system will fallback on the default validation criteria.
Parameters
- $type
-
(string) The entity type for which the user wants to leave a review (service or employee).
- $id
-
(int) The entity ID for which the review should be left.
- $user
-
(object) An object holding the details of the currently logged in user, if any.
Return Value
Boolean. Use true to allow the user to leave a review.
Example
The example below is used to always allow the users to leave a review, even if they already left a review for the same entity.
/**
* Trigger event to override the default system criteria used to
* validate whether a review should be left or not.
*
* @param string $type The entity type (service or employee).
* @param integer $id The entity ID for which the review should be left.
* @param JUser $user The current user object.
*
* @return boolean True if the review should be left.
*/
public function onValidateLeaveReview($type, $id, $user)
{
return true;
}
Changelog
Version | Description |
---|---|
1.6 | Introduced. |
Last Update: 2021-10-08 15:33
Helpful?