PDA

View Full Version : Adding posts to nominated thread


jagtpf
02-26-2016, 08:41 AM
Could someone point out to me how to copy the content of the first post in a thread and send that as a post to a nominated thread. Can it be done using datamanager?

I have a .php working that sends the URL of a nominated thread into a new thread.
Coding Problem (https://vborg.vbsupport.ru/showthread.php?t=321729).

Looking around there's a comment in vB4 posts that references a vB3 article Create New Post (https://vborg.vbsupport.ru/showthread.php?t=321729) that I could follow to add posts to a thread - but what I'm not sure of is how to obtain the text content of the source.

Could anyone provide a few pointers .....

MarkFL
02-26-2016, 01:38 PM
Suppose you have the threadid of the thread whose first post content you want to grab, stored in $threadid. You can the query the database as follows:

$fposts = $vbulletin->db->query_read("
SELECT post.*
FROM " . TABLE_PREFIX . "post AS post
WHERE threadid = " . $threadid . "
AND parentid = 0
");

$fpost = $db->fetch_array($fposts);

$postcontent = $fpost['pagetext'];


Now you have the content of the first post in the thread stored in $postcontent. :)