public function validate($form, $data, $group = null) { /*$data = parent::validate($form, $data, $group); if ($data == false) { return false; }*/ $params = JComponentHelper::getParams('com_djcatalog2'); $user = JFactory::getUser(); $recordId = (int) isset($data['id']) ? $data['id'] : 0; $ownerId = (int) $user->id; $default_state = (int) $params->get('fed_default_state', '0'); $canEdit = $user->authorise('core.edit.state', $this->option); $canEditOwn = $user->authorise('core.edit.state.own', $this->option); $record = null; if ($recordId) { $record = $this->getItem($recordId); } if ($record) { if (!($canEdit || $canEditOwn && $record->created_by == $ownerId)) { $data['published'] = $record->published; } else { if (empty($data['published'])) { $data['published'] = $default_state; } } if (!empty($record->created_by)) { $data['created_by'] = $record->created_by; } else { $data['created_by'] = $user->id; } } else { if (!$canEditOwn && !$canEdit || empty($data['published'])) { $data['published'] = $default_state; } $data['created_by'] = $user->id; } $form->setValue('created_by', null, $data['created_by']); return parent::validate($form, $data, $group); //return $data; }