How to validate email in Wordpress DB (check if email already exist)??

pierpul 16 May, 2017
Hi GreyHead, how are you?
I want validate email field in Wordpress Chronoforms form.
If email already exist -> event loop and Display Message "eMail alreasy exist"
If no, DB Save etc etc

This is my script, but don't work:
<?php

global $wpdb;

$user = wp_get_current_user();

$query = $wpdb->get_results(" SELECT user_email FROM 'wpds_cf_studente' WHERE 'user_login' = '$user'"); 

if ($query) {
return "fail"; // user email already registered
} else {
return "success";
}

?>

In forums there are many examples for Joomla, but not for Wordpress....

Can you help me?

Thanks

Matteo
pierpul 18 May, 2017
I've put above script in Event Switcher. please, can you help me?
Probably there is problem/issue with custom code in "on success" event switcher…
This topic is locked and no more replies can be posted.