Error with email varification(helper/controller) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Error with email varification(helper/controller) (/showthread.php?tid=74091) |
Error with email varification(helper/controller) - Mekaboo - 07-20-2019 Hello! When I press activtate to login after register I get an error 404 code. I seems as if the code created withn DB is not linking well. I have a helper and controller but cant seem to figure out which is causing it: Code(helper): Account verification email sender function */ if(! function_exists('emailVerification')){ function emailVerification($userID){ $ci =& get_instance(); $ci->load->library('email'); $ci->load->model('user'); $con['returnType'] = 'single'; $con['conditions'] = array( 'id' => $userID ); $user = $ci->user->getRows($con); $emailVerifyLink = base_url().'verifyEmail/'.$user['activation_code']; $config['mailtype'] = 'html'; $ci->email->initialize($config); $ci->email->to($user['email']); $ci->email->from(' [email protected]', 'Cultured Kink'); $ci->email->subject('Please Confirm Your Email | Cultured Kink'); $ci->email->message($mailContent); $ci->email->send(); return true; } } Code(controller): * User email verification */ public function verifyEmail($activation_code){ //redirect logged in user to dashboard if($this->userId){ redirect('dashboard'); } $data = array(); //if the activation code is available if(!empty($activation_code)){ //check whether the activation code exists in the database $con['conditions'] = array( 'activation_code' => $activation_code ); $con['returnType'] = 'single'; $checkUser = $this->user->getRows($con); //if activation code is matched if(!empty($checkUser)){ //activate user for login $actData = array('activated' => '1'); $update = $this->user->update($actData, array('activation_code' => $activation_code)); //send user registration email @userRegistrationEmail($checkUser['id'], '*****'); //store status message $this->session->set_userdata('success_msg', 'Email verification for your account was successful. Please login to your account.'); //redirect to login page redirect('login'); }else{ $this->session->set_userdata('error_msg', 'You have clicked on the wrong verification link, please check your email and try again.'); redirect('login'); } }else{ //redirect to login page redirect('login'); } } I apologize if this question is redundant..just need help trying to connect the two so that when a new member gets email they can log in with ease. , Mekaboo RE: Error with email varification(helper/controller) - php_rocs - 07-21-2019 @Mekaboo, Have you tried looking at the generated login link (in the email) that is created? Take that link and see if it works directly. RE: Error with email varification(helper/controller) - Mekaboo - 07-22-2019 (07-21-2019, 06:13 AM)php_rocs Wrote: @Mekaboo, Hey there! I got it figured out..the issue was within my webhost. I didnt have the proper code with my .htaccess file. My webhost updated it for me and now things are working wonderfully!! Thanks so very much RE: Error with email varification(helper/controller) - InsiteFX - 09-09-2019 Code like that should be placed in a library not in a method/function. |