yomyyo Posted November 27, 2019 Share Posted November 27, 2019 I am trying to validate custom fields for my item, but whether or not the custom field is valid, I will be thrown an error. If it's an invalid field it'll say "Please correct the following errors before continuing: This email address is already in use." However if the user gives a valid field, it will just give "Please correct the following errors before continuing:" without anything after. I have the hook set up as so function checkUser($vars){ $postData = array( 'data' => array( 'email' => $vars['customfield'][6], ) ); $ch = curl_init(); if($ch == false){ throw new Exception('failed to init'); } curl_setopt_array($ch, array( CURLOPT_URL => myUrlGoesHere, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HEADER => 0, CURLOPT_POSTFIELDS => http_build_query($postData), )); //Save the result from the request $output = curl_exec($ch); $res = json_decode($output); curl_close($ch); console_log($res); if($res){ $message = "This email address is already in use."; return $message; } } Is there a value I need to return using this hook. Thank you! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.