Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-17-2007, 11:48 AM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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_UINTREQ_INCR,  'return ($data > 0);'),
        
'threadid'       => array(TYPE_UINTREQ_YES),
        
'parentid'       => array(TYPE_UINTREQ_AUTO),
        
'username'       => array(TYPE_STR,  REQ_NO,    VF_METHOD),
        
'userid'         => array(TYPE_UINTREQ_NO,    VF_METHOD),
        
'title'          => array(TYPE_STR,  REQ_NO,    VF_METHOD),
        
'dateline'       => array(TYPE_UINTREQ_AUTO),
        
'pagetext'       => array(TYPE_STR,  REQ_YES,   VF_METHOD),
        
'allowsmilie'    => array(TYPE_UINTREQ_YES), // this is required as we must know whether smilies count as images
        
'showsignature'  => array(TYPE_BOOLREQ_NO),
        
'ipaddress'      => array(TYPE_STR,  REQ_AUTO),
        
'iconid'         => array(TYPE_UINTREQ_NO,    VF_METHOD),
        
'visible'        => array(TYPE_UINTREQ_NO),
        
'attach'         => array(TYPE_UINTREQ_NO),
        
'infraction'     => array(TYPE_UINTREQ_NO),
        
'reportthreadid' => array(TYPE_UINTREQ_NO),   
    ); 
into

PHP Code:
    var $validfields = array(
        
'postid'         => array(TYPE_UINTREQ_INCR,  'return ($data > 0);'),
        
'threadid'       => array(TYPE_UINTREQ_YES),
        
'parentid'       => array(TYPE_UINTREQ_AUTO),
        
'username'       => array(TYPE_STR,  REQ_NO,    VF_METHOD),
        
'userid'         => array(TYPE_UINTREQ_NO,    VF_METHOD),
        
'title'          => array(TYPE_STR,  REQ_NO,    VF_METHOD),
        
'dateline'       => array(TYPE_UINTREQ_AUTO),
        
'pagetext'       => array(TYPE_STR,  REQ_YES,   VF_METHOD),
        
'allowsmilie'    => array(TYPE_UINTREQ_YES), // this is required as we must know whether smilies count as images
        
'showsignature'  => array(TYPE_BOOLREQ_NO),
        
'ipaddress'      => array(TYPE_STR,  REQ_AUTO),
        
'iconid'         => array(TYPE_UINTREQ_NO,    VF_METHOD),
        
'visible'        => array(TYPE_UINTREQ_NO),
        
'attach'         => array(TYPE_UINTREQ_NO),
        
'infraction'     => array(TYPE_UINTREQ_NO),
        
'reportthreadid' => array(TYPE_UINTREQ_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_UINTREQ_AUTO),
        
'lastpost'      => array(TYPE_UINTREQ_AUTO),
        
'forumid'       => array(TYPE_UINTREQ_YES),
        
'pollid'        => array(TYPE_UINTREQ_NO),
        
'open'          => array(TYPE_UINTREQ_AUTO,   VF_METHOD),
        
'replycount'    => array(TYPE_UINTREQ_AUTO),
        
'hiddencount'   => array(TYPE_UINTREQ_AUTO),
        
'deletedcount'  => array(TYPE_UINTREQ_AUTO),
        
'lastposter'    => array(TYPE_STR,  REQ_AUTO),
        
'lastpostid'    => array(TYPE_UINTREQ_AUTO),
        
'views'         => array(TYPE_UINTREQ_NO),
        
'notes'         => array(TYPE_STR,  REQ_NO),
        
'sticky'        => array(TYPE_UINTREQ_NO,     VF_METHOD),
        
'votenum'       => array(TYPE_UINTREQ_NO),
        
'votetotal'     => array(TYPE_UINTREQ_NO),
        
'similar'       => array(TYPE_STR,  REQ_AUTO),

        
// shared fields
        
'threadid'      => array(TYPE_UINTREQ_INCR),
        
'title'         => array(TYPE_STR,  REQ_YES,    VF_METHOD),
        
'username'      => array(TYPE_STR,  REQ_NO,     VF_METHOD), // maps to thread.postusername
        
'userid'        => array(TYPE_UINTREQ_NO,     VF_METHOD), // maps to thread.postuserid
        
'dateline'      => array(TYPE_UINTREQ_AUTO),
        
'iconid'        => array(TYPE_UINTREQ_NO,     VF_METHOD),
        
'visible'       => array(TYPE_BOOLREQ_NO), // note: post.visible will always be 1 with this object!
        
'attach'        => array(TYPE_UINTREQ_NO),
            
        
'pagetext'      => array(TYPE_STR,  REQ_YES,    VF_METHOD),
        
'allowsmilie'   => array(TYPE_UINTREQ_YES), // this is required as we must know whether smilies count as images
        
'showsignature' => array(TYPE_BOOLREQ_NO),
        
'ipaddress'     => array(TYPE_STR,  REQ_AUTO),
    ); 
info

PHP Code:
    var $validfields = array(
        
'firstpostid'   => array(TYPE_UINTREQ_AUTO),
        
'lastpost'      => array(TYPE_UINTREQ_AUTO),
        
'forumid'       => array(TYPE_UINTREQ_YES),
        
'pollid'        => array(TYPE_UINTREQ_NO),
        
'open'          => array(TYPE_UINTREQ_AUTO,   VF_METHOD),
        
'replycount'    => array(TYPE_UINTREQ_AUTO),
        
'hiddencount'   => array(TYPE_UINTREQ_AUTO),
        
'deletedcount'  => array(TYPE_UINTREQ_AUTO),
        
'lastposter'    => array(TYPE_STR,  REQ_AUTO),
        
'lastpostid'    => array(TYPE_UINTREQ_AUTO),
        
'views'         => array(TYPE_UINTREQ_NO),
        
'notes'         => array(TYPE_STR,  REQ_NO),
        
'sticky'        => array(TYPE_UINTREQ_NO,     VF_METHOD),
        
'votenum'       => array(TYPE_UINTREQ_NO),
        
'votetotal'     => array(TYPE_UINTREQ_NO),
        
'similar'       => array(TYPE_STR,  REQ_AUTO),

        
// shared fields
        
'threadid'      => array(TYPE_UINTREQ_INCR),
        
'title'         => array(TYPE_STR,  REQ_YES,    VF_METHOD),
        
'username'      => array(TYPE_STR,  REQ_NO,     VF_METHOD), // maps to thread.postusername
        
'userid'        => array(TYPE_UINTREQ_NO,     VF_METHOD), // maps to thread.postuserid
        
'dateline'      => array(TYPE_UINTREQ_AUTO),
        
'iconid'        => array(TYPE_UINTREQ_NO,     VF_METHOD),
        
'visible'       => array(TYPE_BOOLREQ_NO), // note: post.visible will always be 1 with this object!
        
'attach'        => array(TYPE_UINTREQ_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_UINTREQ_YES), // this is required as we must know whether smilies count as images
        
'showsignature' => array(TYPE_BOOLREQ_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:
  1. Please complete both the subject and message fields.
  2. The message you have entered is too short. Please lengthen your message to at least 10 characters.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:48 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03647 seconds
  • Memory Usage 2,511KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (14)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete