add_system_message(_("At least one of the parameters is empty."), 'error'); forward($forward_to); } else if (!$TeKe->user->is_valid_email($email)) { $TeKe->add_system_message(_("Email is not valid."), "error"); forward($forward_to); } else if ($TeKe->user->check_email_exists($email) && $id <= 0) { $TeKe->add_system_message(_("User with that email already exists."), "error"); forward($forward_to); } else if ($id > 0) { $user = $TeKe->user->getUserById($id); if ($TeKe->user->check_email_exists($email) && $user->getEmail() != $email) { $TeKe->add_system_message(_("User with that email already exists."), "error"); forward($forward_to); } else { $user_id = $TeKe->plugin->users->editUser($id, $first_name, $last_name, $email, $role, $institution); if ($user_id) { $TeKe->add_system_message(_("Changes saved.")); forward("users/view"); } else { $TeKe->add_system_message(_("Saving failed."), 'error'); forward("users/user/${id}/edit"); } } } else { if ($user_id = $TeKe->plugin->addUser($first_name, $last_name, $email, $role, $institution)) { $TeKe->add_system_message(_("Success.")); } else { $TeKe->add_system_message(_("Registration failed."), 'error'); forward($forward_to); } } unset($_SESSION['input_values']); forward("users/view"); ?>