1

I need in my topic new input field, i added it in template file and in the database #__kunena_topics, in controllers topic.php i added it also to function post() but if i save topic my custom field value is not saved in db, name field has true name etc... are there still files where i must get value from my custom field?

in the controller file i added this field: /components/com_kunena/controllers/topic.php

public function post() {
    $this->id = JRequest::getInt('parentid', 0);
    $fields = array (
        'catid' => $this->catid,
        'name' => JRequest::getString ( 'authorname', $this->me->getName () ),
        'email' => JRequest::getString ( 'email', null ),
        'subject' => JRequest::getVar ( 'subject', null, 'POST', 'string', JREQUEST_ALLOWRAW ),
        'message' => JRequest::getVar ( 'message', null, 'POST', 'string', JREQUEST_ALLOWRAW ),
        'icon_id' => JRequest::getInt ( 'topic_emoticon', null ),
        'anonymous' => JRequest::getInt ( 'anonymous', 0 ),
        'poll_title' => JRequest::getString ( 'poll_title', '' ),
        'poll_options' => JRequest::getVar('polloptionsID', array (), 'post', 'array'),
        'poll_time_to_live' => JRequest::getString ( 'poll_time_to_live', 0 ),
        'tags' => JRequest::getString ( 'tags', null ),
        'mytags' => JRequest::getString ( 'mytags', null ),
        'subscribe' => JRequest::getInt ( 'subscribeMe', 0 ),
        'crmusername' => JRequest::getVar ('crmusername', null)
    );
2
  • If you're using Joomla 3.x then please bare in mind that JRequest is deprecated.
    – Lodder
    Jun 22, 2014 at 21:46
  • Be aware, you can't update Kunena to a newest version anymore.
    – Anibal
    Jun 23, 2014 at 12:12

1 Answer 1

0

It's better if you extend Kunena through a view override and save the new information with a Kunena plugin.

About Component View Override: http://docs.joomla.org/Understanding_Output_Overrides#Component_Output_Types_and_Layout_Overrides

About Kunena plugins: examples http://www.kunena.org/docs/Kunena_Add-ons TIP: onKunenaAfterSave

Not the answer you're looking for? Browse other questions tagged or ask your own question.