Nguyễn duyên
New member
Auto-posting for XenForo refers to the use of tools or scripts to automate the process of posting on a XenForo forum. This can include creating new threads, replying to posts, or updating content without manual intervention. These tools are typically programmed to perform tasks automatically based on a schedule or specific input data.
Mã:
<?php
$dir = "_path_xenforo";
require($dir . '/src/XF.php');
XF::start($dir);
$forumId = '2'; // ID của mục cần post
$userId = '1'; //User ID # ID của tài khoản cần post
//$countfile='count.txt';
//$check_ID_CSV
$title = "title";
$message = 'content';
$tag = 'tag 1, tag 2';
$forum = \XF::em()->find('XF:Forum', $forumId);
$user = \XF::em()->find('XF:User', $userId);
\XF::asVisitor($user, function() use ($forum, $title, $message, $tag )
{
$creator = \XF::service('XF:Thread\Creator', $forum);
$creator->setContent($title, $message, $tag );
$creator->setPrefix('1'); //Prefix ID # to set new thread as.
$creator->setIsAutomated();
$creator->save();
});