/** * Validate the form */ protected function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); // validation $fields = $this->frm->getFields(); $fields['username']->isFilled(Language::err('FieldIsRequired')); if ($this->frm->isCorrect()) { $item['id'] = $this->id; $item['username'] = $fields['username']->getValue(); // lookup user id $userObj = Helper::searchUser($item['username']); if (isset($userObj->data)) { $userId = $userObj->data[0]->id; $item['user_id'] = $userId; } else { $this->redirect(Model::createURLForAction('Index') . '&error=api_error'); } BackendInstagramModel::update($item); $item['id'] = $this->id; Model::triggerEvent($this->getModule(), 'after_edit', $item); $this->redirect(Model::createURLForAction('Index') . '&report=edited&highlight=row-' . $item['id']); } } }