Last active
July 4, 2020 05:45
-
-
Save danielpowney/f98e8c2bc64f6159d50c05adf2023107 to your computer and use it in GitHub Desktop.
mr_custom_rating_form_validation_check.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom rating form validation free version | |
* | |
* @param unknown $validation_results | |
* @param unknown $data | |
* @return $validation_results | |
*/ | |
function mr_custom_rating_form_validation_check( $validation_results, $data ) { | |
$post_id = $data['post_id']; | |
global $wp_roles; | |
$user = wp_get_current_user(); | |
$user_id = $user->ID; | |
/* Add custom check here */ | |
if ( true ) { | |
array_push( $validation_results, array( | |
'severity' => 'error', | |
'field' => 'name', | |
'name' => 'my_error', | |
'message' => __( 'My error.', 'multi-rating-pro' ) ) ); | |
} | |
return $validation_results; | |
} | |
add_filter( 'mr_after_rating_form_validation_save', 'mr_custom_rating_form_validation_check', 10, 12); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment