vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Auto-creation of threads? (https://vborg.vbsupport.ru/showthread.php?t=61030)

fly 02-23-2005 11:16 AM

What's on line 938 of functions.php?

zeropaid 02-23-2005 05:02 PM

PHP Code:

    938         $user $DB_site->query_first("
    939                 SELECT " 
.
    
940                 iif(($option 16), ' administrator.*, ') . "
    941                 userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate,
    942                 IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid" 
.
    
943                 iif(($option 1) AND $vboptions['reputationenable'] == 1', level') .
    
944                 iif(($option 2) AND $vboptions['avatarenabled'], ', avatar.avatarpath, NOT ISNULL(customavatar.avatardata) AS hascustomavatar, customavatar.dateline AS avatardateline').
    
945                 iif(($option 8), ', customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline') .
    
946                 iif(!isset($vbphrase), fetch_language_fields_sql(), '') . "
    947                 FROM " 
TABLE_PREFIX "user AS user
    948                 LEFT JOIN " 
TABLE_PREFIX "userfield AS userfield ON (user.userid = userfield.userid)
    949                 LEFT JOIN " 
TABLE_PREFIX "usertextfield AS usertextfield ON (usertextfield.userid = user.userid) " .
    
950                 iif(($option 1) AND $vboptions['reputationenable'] == 1"LEFT JOIN  " TABLE_PREFIX "reputationlevel AS reputationlevel ON (user.reputationlevelid = reputationlevel.re        putationlevelid) ").
    
951                 iif(($option 2) AND $vboptions['avatarenabled'], "LEFT JOIN " TABLE_PREFIX "avatar AS avatar ON (avatar.avatarid = user.avatarid) LEFT JOIN " TABLE_PREFIX "customa        vatar AS customavatar ON (customavatar.userid = user.userid) ") .
    
952                 iif(($option 8), "LEFT JOIN " TABLE_PREFIX "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid) ") .
    
953                 iif(($option 16), "LEFT JOIN " TABLE_PREFIX "administrator AS administrator ON (administrator.userid = user.userid) ") .
    
954                 iif(!isset($vbphrase), "INNER JOIN " TABLE_PREFIX "language AS language ON (language.languageid = IF(user.languageid = 0, " intval($vboptions['languageid']) . ", user.        languageid)) ")."
    955                 WHERE user.userid = 
$userid
    956         "
); 


mtrac 03-02-2005 01:10 AM

Excellent thread. I hooked the auto-creation up to the CaRP RSS parser and a couple of cron jobs and now have this.

Today's question is how do I create calendar events? I'd be interested in a year at a time; i.e. monthly board meeting schedules. I'm thinking of inserting a text file into vb3_event with PHPMyAdmin but would like something more sophisticated.

Thanks.

fly 03-02-2005 10:59 AM

Quote:

Originally Posted by mtrac
Excellent thread. I hooked the auto-creation up to the CaRP RSS parser and a couple of cron jobs and now have this.

Today's question is how do I create calendar events? I'd be interested in a year at a time; i.e. monthly board meeting schedules. I'm thinking of inserting a text file into vb3_event with PHPMyAdmin but would like something more sophisticated.

Thanks.

Search here for news2vb also...

zeropaid 03-07-2005 11:03 PM

Ok, I figured out my problem. Has anyone got this code to work inside a function? When I run it normally, it works fine. When I put it inside a function, I get all kinds of errors.

fly 03-08-2005 11:21 AM

Quote:

Originally Posted by zeropaid
Ok, I figured out my problem. Has anyone got this code to work inside a function? When I run it normally, it works fine. When I put it inside a function, I get all kinds of errors.

Can you post what you're doing?

zeropaid 03-11-2005 09:09 PM

PHP Code:

<?
require_once("../classes/nested.php");
require_once("../classes/form.php");
require_once("../classes/mysql.php");

$nested = new Nested;
$forms = new Forms;

function doforum () {
global $forumcache;


# Do forum stuff

 chdir('/usr/local/www/htdocs/bbs');

// Load vB-Backend

$globaltemplates = array();
$specialtemplates = array();
$actiontemplates = array();

#require_once('./includes/db_mysql.php');
require_once('./global.php');
require_once('./includes/functions_newpost.php');

#if ($_POST[news_user_id] == 0 || !$_POST[news_user_id]) {
#        $userid = 1;
#} else {
#        $userid = 1;
#}

//$userid = $_POST[news_user_id]; // The user creating the thread
$userid = 1;
$forumid = 34; // The forum where the thread should be posted

// Get forum & user info
$foruminfo = fetch_foruminfo($forumid);
$bbuserinfo = fetch_userinfo($userid);

#print_r($bbuserinfo);

$title = "this is the title";
$article = "this is the body of the article where the text would go.... need to parse html out, maybe just link to the story";

// Setup the thread
$post[title] = $title;
$post[message] = $article;
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[emailupdate] = 9999;

// build the thread
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);

// Errors?
if (sizeof($errors) > 0) {
  ?>There have been errors. <?=$errors?><?
  print_r($errors);
  die('errors');
}

$ThreadID = $post['threadid'];
$PostID = $post['postid'];

print ("the threadid is $ThreadID and the postid is $PostID");
}

doforum();
?>


Which returns:

Warning: array_keys() [function.array-keys]: The first argument should be an array in /includes/functions.php on line 3089

Warning: Invalid argument supplied for foreach() in /includes/functions.php on line 3089

Fatal error: Call to a member function query() on a non-object in /usr/local/www/htdocs/bbs/includes/functions.php on line 2298

Fatal error: Call to undefined method stdClass::query() in /usr/local/www/htdocs/bbs/includes/functions.php on line 524

I also have the same code outside a function, which works fine:

PHP Code:

<?
require_once("../classes/nested.php");
require_once("../classes/form.php");
require_once("../classes/mysql.php");

$nested = new Nested;
$forms = new Forms;

global $forumcache;


# Do forum stuff

 chdir('/usr/local/www/htdocs/bbs');

// Load vB-Backend

$globaltemplates = array();
$specialtemplates = array();
$actiontemplates = array();

#require_once('./includes/db_mysql.php');
require_once('./global.php');
require_once('./includes/functions_newpost.php');

#if ($_POST[news_user_id] == 0 || !$_POST[news_user_id]) {
#        $userid = 1;
#} else {
#        $userid = 1;
#}

//$userid = $_POST[news_user_id]; // The user creating the thread
$userid = 1;
$forumid = 34; // The forum where the thread should be posted

// Get forum & user info
$foruminfo = fetch_foruminfo($forumid);
$bbuserinfo = fetch_userinfo($userid);

#print_r($bbuserinfo);

$title = "this is the title";
$article = "this is the body of the article where the text would go.... need to parse html out, maybe just link to the story";

// Setup the thread
$post[title] = $title;
$post[message] = $article;
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[emailupdate] = 9999;

// build the thread
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);

// Errors?
if (sizeof($errors) > 0) {
  ?>There have been errors. <?=$errors?><?
  print_r($errors);
  die('errors');
}

$ThreadID = $post['threadid'];
$PostID = $post['postid'];

print ("the threadid is $ThreadID and the postid is $PostID");
?>

It seems like it is missing some data inside that function or something.

Marco van Herwaarden 03-12-2005 04:45 AM

I didn't really go through your code, but try getting the userinfo before the foruminfo.

zeropaid 03-14-2005 04:23 AM

yeah the code is pretty long and convoluted, the bottom line is when i run it just in a normal test script it works perfectly, when I put it in any sort of function construct it fails as soon as it tries to execute any vb code.

Lee Wilde 03-17-2005 01:22 AM

You may be interested in this hack just released by deathemperor:

Calendar Search and Comments for Events
https://vborg.vbsupport.ru/showthread.php?p=626269


All times are GMT. The time now is 08:40 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.01365 seconds
  • Memory Usage 1,777KB
  • 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
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete