$data = array('new_email' => null, 'new_email_code' => null); $user = User::updateUser($userId, $data); $response = new stdClass(); if ($user) { $response->status = 'success'; } else { $response->status = 'error'; } echo json_encode($response); die; } // New email confirmation if ($action == 'new_email_confirmation') { $actCode = $app->getRequest()->get('act_code'); $newEmailCode = $app->getRequest()->get('new_email_code'); $user = User::getUserToConfirmNewEmail($actCode, $newEmailCode); if (!$user) { $app->addError("Ha ocurrido un error intentando confirmar un cambio de correo electrónico."); } else { $user->user = $user->new_email; $user->new_email = null; $user->new_email_code = null; $user->save(); $app->addMessage("Tu correo electrónico ha sido cambiado exitosamente. Tu nueva cuenta de correo electrónico es <b>" . $user->user . "</b>"); } $app->redirect(UrlHelper::getUrl('editarPerfil')); return; } //marcar notificaciones como leidas if ($action == "notificationAct") { $id = intval($_REQUEST['id']);