public function checkEmail(MemberEntity $member) { global $wpdb; $row = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}algomember WHERE email ='" . $member->email() . "'"); if (is_null($row)) { return FALSE; } else { return TRUE; } }
public function saveData() { if (isset($_POST['mise_a_jour_profil'])) { // envoie if (isset($_POST['algomember_email']) && $_POST['algomember_email'] != '') { // non null $email = $_POST['algomember_email']; if ($this->isValid($email)) { // validité $member = new MemberEntity(); $member->setName($_POST['algomember_name']); $member->setFirst_name($_POST['algomember_first_name']); $member->setEmail($_POST['algomember_email']); $member->setBirth_date($_POST['algomember_birth_date']); $member->setGender($_POST['algomember_gender']); $member->setContry($_POST['algomember_contry']); $member->setTown($_POST['algomember_town']); $member->setWebsite($_POST['algomember_website']); $member->setLanguage($_POST['algomember_language']); $member->setNationality($_POST['algomember_nationality']); $member->setSkype_id($_POST['algomember_skype_id']); // var_dump($member); $memberManager = new MemberManager(); if ($memberManager->checkEmail($member)) { $memberManager->modify($member); } else { $memberManager->add($member); } // controle existance du mail en bdd test // if () } else { echo 'mail non valide'; } } else { echo 'mail non renseigné'; } } }