Validate Leave
apply_filters( 'vikappointments_validate_leave_review', bool $allow, string $type, int $id, object $user )
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
- $allow
-
(bool) Use true to allow the user to leave a review.
- $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.
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 boolean $allow True if the review should be left.
* @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.
*/
add_filter('vikappointments_validate_leave_review', function($allow, $type, $id, $user)
{
return true;
}, 10, 4);
Changelog
Version | Description |
---|---|
1.0 | Introduced. |
Last Update: 2021-10-04
Helpful?