1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to add options with frontend pages and how to save these options in related table column

Discussion in 'XenForo Development Discussions' started by arpitjain, Nov 9, 2013.

  1. arpitjain

    arpitjain Member

    i have created three radio buttons with create thread page for my addon and i have added a column with (xf_thread) table
    i want to save selected radio button value to this column of each thread that i create ...how to save radio buttons value to related column of table ...
  2. Jeremy

    Jeremy Well-Known Member

    Extend the thread datawriter via the class proxy system and inject the data.
  3. arpitjain

    arpitjain Member

    please explain with example...
  4. arpitjain

    arpitjain Member

    i have extend the thread controller and try to save through this code with in my action for each new resource ..is this right way
    $writer = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
    $writer->set('myfield', $_POST[' radiobuttonname ']);
  5. arpitjain

    arpitjain Member

    this is myfile that i extend with my addon DataWriter/thread.php
    class FD_TitleCase_DataWriter_Thread extends XFCP_FD_TitleCase_DataWriter_Thread
    protected function _getFields()
    $fields = parent::_getFields();
    $fields[$this->_modTableName]['t_case'] = array('type' => self::TYPE_STRING, 'default' => '');
    return $fields;
    and i have add this code with listner .....
    public static function load_class_datawriter($class, array &$extend)

    if($class == 'XenForo_DataWriter_Discussion_Thread')
    $extend[] = 'FD_TitleCase_DataWriter_Thread';

    bat when i create a new thread and save ... it show me an error
    Undefined property: FD_TitleCase_DataWriter_Thread::$_modTableName
    where is the problem ...

    and i have create three radio button with this create related template with name mybuttons ...
    im tring to get its value through
    $text = $this->_input->filterSingle('mybuttons', XenForo_Input::STRING);
    and want to save in column t_case that i want to create in xf_thread..how it is possible...please reply

Share This Page