![]() |
Create a new thread via vBulletin API
Hi,
iam trying to use this code to create a thread via vBulletin cron job: Code:
<?php Exact error message (in german): "array(2) { [0]=> string(110) "Der Text, den du eingegeben hast, ist zu kurz. Bitte erweitere den Text auf die minimale L?nge von 10 Zeichen." [1]=> string(49) "Bitte f?lle das Titel- und das Nachrichtfeld aus." } " What am I doing wrong? Edit: I would like to create a query to my database in this script with "$db->query_first" but there is no $db-object so i get an error. can i get the db-object from vbulletin somehow? Thanks in advance |
I think your problem is with these two lines:
Code:
$title = addslashes($_POST["test title bla bla test"]); // The title of the thread I'm not sure why you had trouble with the $db object, it should be defined (unless you had your code inside a function, then you'd need a global statement). |
You can use $vbulletin->db, in some scripts $db is just a reference to $vbulletin->db
|
thank you both! everything is working right now =)
|
Hi,
I would like to import threads from a csv file and I was wondering what is the best way to do it? It contains the following columns "forum id", "user name", "title", "post text", "post date" thanks |
Quote:
|
thanks. How do I replace my .csv with the following fields. I mean how do I read from my csv and insert into those variables?
For +10000 thread, do I just create a loop and let looping the entire code for the number of threads? Code:
$forumid = 7; // The id of the forum we are posting to |
Well, that's more of a php-related problem...
How is your knowledge in php? basically all you need is fopen, fread, fclose, foreach/while and preg_match if you're good with regex, otherwise explode and trim. All those functions can be looked-up here: http://php.net/ |
Can this be turned into a widget for any registered member to use.
Something like "Post a Question" and have it show up in a specific forum or thread. |
Quote:
|
All times are GMT. The time now is 10:00 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|