Extra Post Fields ?
i have tried to add 3 extra fields to my new post for chosen forum but its not inserting anything. here what i have done so far.
in the database table post i have added 4 fields img, info, trailer and url.
and a normal newthread form but with extra fields and there names are
for table img fieldname is txtImage
for table trailer fieldname is txtTrailer
for table url fieldname is url
for table info fieldname is infotext
in class_dm_threadpost.php: i changed
PHP Code:
var $validfields = array( 'postid' => array(TYPE_UINT, REQ_INCR, 'return ($data > 0);'), 'threadid' => array(TYPE_UINT, REQ_YES), 'parentid' => array(TYPE_UINT, REQ_AUTO), 'username' => array(TYPE_STR, REQ_NO, VF_METHOD), 'userid' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'title' => array(TYPE_STR, REQ_NO, VF_METHOD), 'dateline' => array(TYPE_UINT, REQ_AUTO), 'pagetext' => array(TYPE_STR, REQ_YES, VF_METHOD), 'allowsmilie' => array(TYPE_UINT, REQ_YES), // this is required as we must know whether smilies count as images 'showsignature' => array(TYPE_BOOL, REQ_NO), 'ipaddress' => array(TYPE_STR, REQ_AUTO), 'iconid' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'visible' => array(TYPE_UINT, REQ_NO), 'attach' => array(TYPE_UINT, REQ_NO), 'infraction' => array(TYPE_UINT, REQ_NO), 'reportthreadid' => array(TYPE_UINT, REQ_NO), );
into
PHP Code:
var $validfields = array( 'postid' => array(TYPE_UINT, REQ_INCR, 'return ($data > 0);'), 'threadid' => array(TYPE_UINT, REQ_YES), 'parentid' => array(TYPE_UINT, REQ_AUTO), 'username' => array(TYPE_STR, REQ_NO, VF_METHOD), 'userid' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'title' => array(TYPE_STR, REQ_NO, VF_METHOD), 'dateline' => array(TYPE_UINT, REQ_AUTO), 'pagetext' => array(TYPE_STR, REQ_YES, VF_METHOD), 'allowsmilie' => array(TYPE_UINT, REQ_YES), // this is required as we must know whether smilies count as images 'showsignature' => array(TYPE_BOOL, REQ_NO), 'ipaddress' => array(TYPE_STR, REQ_AUTO), 'iconid' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'visible' => array(TYPE_UINT, REQ_NO), 'attach' => array(TYPE_UINT, REQ_NO), 'infraction' => array(TYPE_UINT, REQ_NO), 'reportthreadid' => array(TYPE_UINT, REQ_NO), 'info' => array(TYPE_STR, REQ_NO), 'url' => array(TYPE_STR, REQ_NO), 'img' => array(TYPE_STR, REQ_NO), 'trailer' => array(TYPE_STR, REQ_NO), );
and then in same file i changed
PHP Code:
var $validfields = array( 'firstpostid' => array(TYPE_UINT, REQ_AUTO), 'lastpost' => array(TYPE_UINT, REQ_AUTO), 'forumid' => array(TYPE_UINT, REQ_YES), 'pollid' => array(TYPE_UINT, REQ_NO), 'open' => array(TYPE_UINT, REQ_AUTO, VF_METHOD), 'replycount' => array(TYPE_UINT, REQ_AUTO), 'hiddencount' => array(TYPE_UINT, REQ_AUTO), 'deletedcount' => array(TYPE_UINT, REQ_AUTO), 'lastposter' => array(TYPE_STR, REQ_AUTO), 'lastpostid' => array(TYPE_UINT, REQ_AUTO), 'views' => array(TYPE_UINT, REQ_NO), 'notes' => array(TYPE_STR, REQ_NO), 'sticky' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'votenum' => array(TYPE_UINT, REQ_NO), 'votetotal' => array(TYPE_UINT, REQ_NO), 'similar' => array(TYPE_STR, REQ_AUTO),
// shared fields 'threadid' => array(TYPE_UINT, REQ_INCR), 'title' => array(TYPE_STR, REQ_YES, VF_METHOD), 'username' => array(TYPE_STR, REQ_NO, VF_METHOD), // maps to thread.postusername 'userid' => array(TYPE_UINT, REQ_NO, VF_METHOD), // maps to thread.postuserid 'dateline' => array(TYPE_UINT, REQ_AUTO), 'iconid' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'visible' => array(TYPE_BOOL, REQ_NO), // note: post.visible will always be 1 with this object! 'attach' => array(TYPE_UINT, REQ_NO), 'pagetext' => array(TYPE_STR, REQ_YES, VF_METHOD), 'allowsmilie' => array(TYPE_UINT, REQ_YES), // this is required as we must know whether smilies count as images 'showsignature' => array(TYPE_BOOL, REQ_NO), 'ipaddress' => array(TYPE_STR, REQ_AUTO), );
info
PHP Code:
var $validfields = array( 'firstpostid' => array(TYPE_UINT, REQ_AUTO), 'lastpost' => array(TYPE_UINT, REQ_AUTO), 'forumid' => array(TYPE_UINT, REQ_YES), 'pollid' => array(TYPE_UINT, REQ_NO), 'open' => array(TYPE_UINT, REQ_AUTO, VF_METHOD), 'replycount' => array(TYPE_UINT, REQ_AUTO), 'hiddencount' => array(TYPE_UINT, REQ_AUTO), 'deletedcount' => array(TYPE_UINT, REQ_AUTO), 'lastposter' => array(TYPE_STR, REQ_AUTO), 'lastpostid' => array(TYPE_UINT, REQ_AUTO), 'views' => array(TYPE_UINT, REQ_NO), 'notes' => array(TYPE_STR, REQ_NO), 'sticky' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'votenum' => array(TYPE_UINT, REQ_NO), 'votetotal' => array(TYPE_UINT, REQ_NO), 'similar' => array(TYPE_STR, REQ_AUTO),
// shared fields 'threadid' => array(TYPE_UINT, REQ_INCR), 'title' => array(TYPE_STR, REQ_YES, VF_METHOD), 'username' => array(TYPE_STR, REQ_NO, VF_METHOD), // maps to thread.postusername 'userid' => array(TYPE_UINT, REQ_NO, VF_METHOD), // maps to thread.postuserid 'dateline' => array(TYPE_UINT, REQ_AUTO), 'iconid' => array(TYPE_UINT, REQ_NO, VF_METHOD), 'visible' => array(TYPE_BOOL, REQ_NO), // note: post.visible will always be 1 with this object! 'attach' => array(TYPE_UINT, REQ_NO), 'info' => array(TYPE_STR, REQ_NO), 'url' => array(TYPE_STR, REQ_NO), 'img' => array(TYPE_STR, REQ_NO), 'trailer' => array(TYPE_STR, REQ_NO), 'pagetext' => array(TYPE_STR, REQ_YES, VF_METHOD), 'allowsmilie' => array(TYPE_UINT, REQ_YES), // this is required as we must know whether smilies count as images 'showsignature' => array(TYPE_BOOL, REQ_NO), 'ipaddress' => array(TYPE_STR, REQ_AUTO), );
and then in same file i changed
PHP Code:
case 'pagetext': case 'allowsmilie': case 'showsignature': case 'ipaddress': { $tables = array('post'); }
into
PHP Code:
case 'pagetext': case 'allowsmilie': case 'showsignature': case 'ipaddress': case 'info': case 'url': case 'img': case 'trailer': { $tables = array('post'); }
then in functions_newpost.php i changed
PHP Code:
// set data $dataman->setr('userid', $vbulletin->userinfo['userid']); if ($vbulletin->userinfo['userid'] == 0) { $dataman->setr('username', $post['username']); } $dataman->setr('title', $post['title']); $dataman->setr('pagetext', $post['message']); $dataman->setr('iconid', $post['iconid']);
into
PHP Code:
// set data $dataman->setr('userid', $vbulletin->userinfo['userid']); if ($vbulletin->userinfo['userid'] == 0) { $dataman->setr('username', $post['username']); } if (in_array($foruminfo['forumid'], array($vbulletin->options['info_forumids']))) { $dataman->setr('title', $post['txtTitle']); $dataman->setr('pagetext', $post['txtDesc']); } else { $dataman->setr('title', $post['title']); $dataman->setr('pagetext', $post['message']); } $dataman->setr('iconid', $post['iconid']); $dataman->set('img', $post['txtImage']); $dataman->set('url', $post['url']); $dataman->set('trailer', $post['txtTrailer']); $dataman->set('info', $post['infotext']);
and then in newthread.php i changed
PHP Code:
$vbulletin->input->clean_array_gpc('p', array( 'wysiwyg' => TYPE_BOOL, 'message' => TYPE_STR, 'postpoll' => TYPE_BOOL, 'subject' => TYPE_STR, 'iconid' => TYPE_UINT, 'signature' => TYPE_BOOL, 'preview' => TYPE_STR, 'disablesmilies' => TYPE_BOOL, 'rating' => TYPE_UINT, 'polloptions' => TYPE_UINT, 'folderid' => TYPE_UINT, 'emailupdate' => TYPE_UINT, 'stickunstick' => TYPE_BOOL, 'openclose' => TYPE_BOOL, 'parseurl' => TYPE_BOOL, 'username' => TYPE_STR, 'loggedinuser' => TYPE_INT, 'imagehash' => TYPE_STR, 'imagestamp' => TYPE_STR, 'podcasturl' => TYPE_STR, 'podcastsize' => TYPE_UINT, 'podcastexplicit' => TYPE_BOOL, 'podcastkeywords' => TYPE_STR, 'podcastsubtitle' => TYPE_STR, 'podcastauthor' => TYPE_STR, ));
into
PHP Code:
$vbulletin->input->clean_array_gpc('p', array( 'wysiwyg' => TYPE_BOOL, 'message' => TYPE_STR, 'infotext' => TYPE_STR, 'url' => TYPE_STR, 'txtImage' => TYPE_STR, 'txtTrailer' => TYPE_STR, 'txtDesc' => TYPE_STR, 'txtTitle' => TYPE_STR, 'postpoll' => TYPE_BOOL, 'subject' => TYPE_STR, 'iconid' => TYPE_UINT, 'signature' => TYPE_BOOL, 'preview' => TYPE_STR, 'disablesmilies' => TYPE_BOOL, 'rating' => TYPE_UINT, 'polloptions' => TYPE_UINT, 'folderid' => TYPE_UINT, 'emailupdate' => TYPE_UINT, 'stickunstick' => TYPE_BOOL, 'openclose' => TYPE_BOOL, 'parseurl' => TYPE_BOOL, 'username' => TYPE_STR, 'loggedinuser' => TYPE_INT, 'imagehash' => TYPE_STR, 'imagestamp' => TYPE_STR, 'podcasturl' => TYPE_STR, 'podcastsize' => TYPE_UINT, 'podcastexplicit' => TYPE_BOOL, 'podcastkeywords' => TYPE_STR, 'podcastsubtitle' => TYPE_STR, 'podcastauthor' => TYPE_STR, ));
and then in same file i changed
PHP Code:
$newpost['title'] =& $vbulletin->GPC['subject']; $newpost['iconid'] =& $vbulletin->GPC['iconid']; $newpost['parseurl'] = ($foruminfo['allowbbcode'] AND $vbulletin->GPC['parseurl']); $newpost['signature'] =& $vbulletin->GPC['signature']; $newpost['preview'] =& $vbulletin->GPC['preview']; $newpost['disablesmilies'] =& $vbulletin->GPC['disablesmilies']; $newpost['rating'] =& $vbulletin->GPC['rating']; $newpost['username'] =& $vbulletin->GPC['username']; $newpost['postpoll'] =& $vbulletin->GPC['postpoll']; $newpost['polloptions'] =& $vbulletin->GPC['polloptions']; $newpost['folderid'] =& $vbulletin->GPC['folderid']; $newpost['imagehash'] =& $vbulletin->GPC['imagehash']; $newpost['imagestamp'] =& $vbulletin->GPC['imagestamp']; $newpost['poststarttime'] = $poststarttime; $newpost['posthash'] = $posthash; // moderation options $newpost['stickunstick'] =& $vbulletin->GPC['stickunstick']; $newpost['openclose'] =& $vbulletin->GPC['openclose']; $newpost['podcasturl'] =& $vbulletin->GPC['podcasturl']; $newpost['podcastsize'] =& $vbulletin->GPC['podcastsize']; $newpost['podcastexplicit'] =& $vbulletin->GPC['podcastexplicit']; $newpost['podcastkeywords'] =& $vbulletin->GPC['podcastkeywords']; $newpost['podcastsubtitle'] =& $vbulletin->GPC['podcastsubtitle']; $newpost['podcastauthor'] =& $vbulletin->GPC['podcastauthor'];
into
PHP Code:
if (in_array($foruminfo['forumid'], array($vbulletin->options['info_forumids']))) { $newpost['message'] =& $vbulletin->GPC['txtDesc']; $newpost['title'] =& $vbulletin->GPC['txtTitle']; } else { $newpost['message'] =& $vbulletin->GPC['message']; $newpost['title'] =& $vbulletin->GPC['subject']; } $newpost['info'] =& $vbulletin->GPC['infotext']; $newpost['url'] =& $vbulletin->GPC['url']; $newpost['img'] =& $vbulletin->GPC['txtImage']; $newpost['trailer'] =& $vbulletin->GPC['txtTrailer']; $newpost['iconid'] =& $vbulletin->GPC['iconid']; $newpost['parseurl'] = ($foruminfo['allowbbcode'] AND $vbulletin->GPC['parseurl']); $newpost['signature'] =& $vbulletin->GPC['signature']; $newpost['preview'] =& $vbulletin->GPC['preview']; $newpost['disablesmilies'] =& $vbulletin->GPC['disablesmilies']; $newpost['rating'] =& $vbulletin->GPC['rating']; $newpost['username'] =& $vbulletin->GPC['username']; $newpost['postpoll'] =& $vbulletin->GPC['postpoll']; $newpost['polloptions'] =& $vbulletin->GPC['polloptions']; $newpost['folderid'] =& $vbulletin->GPC['folderid']; $newpost['imagehash'] =& $vbulletin->GPC['imagehash']; $newpost['imagestamp'] =& $vbulletin->GPC['imagestamp']; $newpost['poststarttime'] = $poststarttime; $newpost['posthash'] = $posthash; // moderation options $newpost['stickunstick'] =& $vbulletin->GPC['stickunstick']; $newpost['openclose'] =& $vbulletin->GPC['openclose']; $newpost['podcasturl'] =& $vbulletin->GPC['podcasturl']; $newpost['podcastsize'] =& $vbulletin->GPC['podcastsize']; $newpost['podcastexplicit'] =& $vbulletin->GPC['podcastexplicit']; $newpost['podcastkeywords'] =& $vbulletin->GPC['podcastkeywords']; $newpost['podcastsubtitle'] =& $vbulletin->GPC['podcastsubtitle']; $newpost['podcastauthor'] =& $vbulletin->GPC['podcastauthor'];
and then in same file i changed
PHP Code:
eval('print_output("' . fetch_template('newthread') . '");');
into
PHP Code:
if (in_array($foruminfo['forumid'], array($vbulletin->options['info_forumids']))) { eval('print_output("' . fetch_template('newinfo') . '");'); } else { eval('print_output("' . fetch_template('newthread') . '");'); }
what am i missing because its just returning
Quote:
The following errors occurred when this message was submitted:- Please complete both the subject and message fields.
- The message you have entered is too short. Please lengthen your message to at least 10 characters.
|
|