RSS Feed/News Thread Creator - Get new Thread's ID

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
23,921
Points
823

Reputation:

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...
 
Status
Not open for further replies.
Top