Thread Creator - Get new Thread's ID

Status
This content is read-only, or is not open for further replies.

nolatron

Guest
offline
I'm using the following code in a php script to generate a forum thread:

Code:

Code:
$dir = WEBSITE_PATH.'/forums';
require($dir . '/src/XF.php');
XF::start($dir);

$forumId = '20';  //Forum ID of where to post thread
$userId = '2';  //User ID # of account to post thread as
$title = "Testing";
$message = '[b]Name:[/b] Test';

$forum = \XF::em()->find('XF:Forum', $forumId);
$user = \XF::em()->find('XF:User', $userId);
\XF::asVisitor($user, function() use ($forum, $title, $message)
{
    $creator =...

Read more

Continue reading...
 
Liked by:
Status
This content is read-only, or is not open for further replies.
Top Bottom