function processchangeemailAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $this->_translate = Zend_Registry::get("translate");
     $formvalues = $this->_getAllParams();
     if (!isArrayKeyAnEmptyString('email', $formvalues)) {
         $user = new UserAccount();
         $user->populate(decode($formvalues['id']));
         // debugMessage($user->toArray());
         if ($user->emailExists($formvalues['email'])) {
             $session->setVar(ERROR_MESSAGE, sprintf($this->_translate->translate("profile_email_unique_error"), $formvalues['email']));
             return false;
         }
         # save new username
         $user->setEmail2($formvalues['email']);
         $user->setActivationKey($user->generateActivationKey());
         $user->save();
         $user->sendNewEmailNotification($formvalues['email']);
         $user->sendOldEmailNotification($formvalues['email']);
         $view = new Zend_View();
         $url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
         $usecase = '1.11';
         $module = '1';
         $type = USER_CHANGE_EMAIL;
         $details = "Email change request for <a href='" . $url . "' class='blockanchor'>" . $user->getName() . "</a> from " . $user->getEmail() . " to " . $user->getEmail2();
         $browser = new Browser();
         $audit_values = $session->getVar('browseraudit');
         $audit_values['module'] = $module;
         $audit_values['usecase'] = $usecase;
         $audit_values['transactiontype'] = $type;
         $audit_values['userid'] = $session->getVar('userid');
         $audit_values['url'] = $url;
         $audit_values['transactiondetails'] = $details;
         $audit_values['status'] = "Y";
         // debugMessage($audit_values);
         $this->notify(new sfEvent($this, $type, $audit_values));
         $successmessage = "A request to change your login email has been recieved. <br />To complete this process check your new email Inbox and click on the activation link sent. ";
         $this->_redirect($this->view->baseUrl('index/updatesuccess/successmessage/' . encode($successmessage)));
     }
 }
 function checkemailAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $formvalues = $this->_getAllParams();
     $email = trim($formvalues['email']);
     // debugMessage($formvalues);
     $user = new UserAccount();
     if (!isArrayKeyAnEmptyString('userid', $formvalues)) {
         $user->populate($formvalues['userid']);
     }
     if ($user->emailExists($email)) {
         echo '1';
     } else {
         echo '0';
     }
 }