vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Building a new thread problem (https://vborg.vbsupport.ru/showthread.php?t=92847)

Dean C 07-25-2005 11:19 AM

Building a new thread problem
 
PHP Code:

    $forumid 26;
    
$foruminfo fetch_foruminfo(forumid);
    
$newpost = array(
        
'emailupdate' => 9999,
        
'userid' => 8,
        
'username' => 'Botty',
        
'title' => 'Application from : ' $vbulletin->GPC['username'
    );
    eval(
'$newpost[message] = "' fetch_template('APPLY_post') . '";');
    require_once(
DIR '/includes/functions_newpost.php');
    
build_new_post('thread'$foruminfo, array(), array(), $newpost$errors); 

That script, when logged in, posts it using my username, not the specified bots name. Why is this happening?

EDIT:

PHP Code:

    // make post
    
$forumid 26;
    
$foruminfo fetch_foruminfo($forumid);
    
$newpost = array(
        
'emailupdate' => 9999,
        
'userid' => 8,
        
'username' => 'VouchBot',
        
'title' => 'Application from : ' $vbulletin->GPC['username'
    );
    eval(
'$newpost[message] = "' fetch_template('APPLY_post') . '";');
    require_once(
DIR '/includes/functions_newpost.php');
    
$olduserid $vbulletin->userinfo['userid'];
    
$vbulletin->userinfo['userid'] = 8;
    
build_new_post('thread'$foruminfo, array(), array(), $newpost$errors);
    
$vbulletin->userinfo['userid'] = $olduserid

This fixes the problem within the postbit, but the lastposter info is incorrect.

mtha 09-10-2005 08:14 PM

Quote:

Originally Posted by Dean C
PHP Code:

    $forumid 26;
    
$foruminfo fetch_foruminfo(forumid);
    
$newpost = array(
        
'emailupdate' => 9999,
        
'userid' => 8,
        
'username' => 'Botty',
        
'title' => 'Application from : ' $vbulletin->GPC['username'
    );
    eval(
'$newpost[message] = "' fetch_template('APPLY_post') . '";');
    require_once(
DIR '/includes/functions_newpost.php');
    
build_new_post('thread'$foruminfo, array(), array(), $newpost$errors); 

That script, when logged in, posts it using my username, not the specified bots name. Why is this happening?

EDIT:

PHP Code:

    // make post
    
$forumid 26;
    
$foruminfo fetch_foruminfo($forumid);
    
$newpost = array(
        
'emailupdate' => 9999,
        
'userid' => 8,
        
'username' => 'VouchBot',
        
'title' => 'Application from : ' $vbulletin->GPC['username'
    );
    eval(
'$newpost[message] = "' fetch_template('APPLY_post') . '";');
    require_once(
DIR '/includes/functions_newpost.php');
    
$olduserid $vbulletin->userinfo['userid'];
    
$vbulletin->userinfo['userid'] = 8;
    
build_new_post('thread'$foruminfo, array(), array(), $newpost$errors);
    
$vbulletin->userinfo['userid'] = $olduserid

This fixes the problem within the postbit, but the lastposter info is incorrect.

was you able to fix the "Lastposter" problem?

I also want to introduce other lastposter value into the field, but havent got any success yet.

Paul M 09-10-2005 08:27 PM

You also need to set

$vbulletin->userinfo['username'] = "Botname";

before calling the build post function.

Andreas 09-10-2005 08:27 PM

You have to overwrite the whole $vbulletin->userinfo array, or avoid using build_new_post()

mtha 09-10-2005 08:51 PM

I got mine worked out with postusername to show what I want.

build_new_post
will call
class_dm_threadpost.php and function verify_userid(&$userid)
this function will set

Code:

                if ($return == true)
                {
                        if (isset($this->validfields['username']))
                        {
                                $this->do_set('username', $this->info['user']['username']);
                        }
                        else if (isset($this->validfields['postusername']))
                        {
                                $this->do_set('postusername', $this->info['user']['username']);
                        }
                }

I try to use a custom field for postusername -> just need to replace it with
Code:

                if ($return == true)
                {
                        if (isset($this->validfields['username']))
                        {
                                $this->do_set('username', $this->info['user']['field10']);
                        }
                        else if (isset($this->validfields['postusername']))
                        {
                                $this->do_set('postusername', $this->info['user']['field10']);
                        }
                }



All times are GMT. The time now is 08:16 PM.

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.01129 seconds
  • Memory Usage 1,758KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete