I have a RSS news feed in my admin cp and you have to locate a forum you want the feed to go to.
It creates a post in this forum lots of times a days and all i would like to do is have all these feeds go in one thread.
Now they did use to have a plugin over at vbulletin.org but that's now shut and I cant even find it on vbulletin.com
I even created my own plugin code below and guess what it dont work
Any help on this would be great
<?php
if (!defined('VB_ENTRY')) die('Access denied.');
// Define the feed URL and the target thread ID
$rss_feed_url = 'https://www.gbnews.com/feeds/news.rss';
$thread_id = 10;
// Fetch the RSS feed with error handling
$rss = @simplexml_load_file($rss_feed_url);
if ($rss === false) {
echo 'Error: Unable to fetch RSS feed. Please check the feed URL or network connection.';
exit;
}
$post_content = '';
foreach ($rss->channel->item as $item) {
$title = (string)$item->title;
$link = (string)$item->link;
$description = (string)$item->description;
$post_content .= "$title\n\n$link\n\n$description\n\n";
}
if (!empty(trim($post_content))) {
global $vbulletin;
$post_data = array(
'threadid' => $thread_id,
'userid' => 1,
'username' => 'The one',
'title' => 'RSS Feed Update',
'pagetext' => $post_content,
'dateline' => TIMENOW,
'visible' => 1
);
// Sanitize user inputs
$username_safe = $vbulletin->db->escape_string($post_data['username']);
$title_safe = $vbulletin->db->escape_string($post_data['title']);
$pagetext_safe = $vbulletin->db->escape_string($post_data['pagetext']);
// Insert the post into the database
$vbulletin->db->query_write("
INSERT INTO " . TABLE_PREFIX . "post
(threadid, userid, username, title, pagetext, dateline, visible)
VALUES
({$post_data['threadid']}, {$post_data['userid']}, '$username_safe', '$title_safe', '$pagetext_safe', {$post_data['dateline']}, {$post_data['visible']})
");
} else {
echo 'Error: No valid content to post from RSS feed.';
}
?>
It creates a post in this forum lots of times a days and all i would like to do is have all these feeds go in one thread.
Now they did use to have a plugin over at vbulletin.org but that's now shut and I cant even find it on vbulletin.com
I even created my own plugin code below and guess what it dont work

Any help on this would be great
<?php
if (!defined('VB_ENTRY')) die('Access denied.');
// Define the feed URL and the target thread ID
$rss_feed_url = 'https://www.gbnews.com/feeds/news.rss';
$thread_id = 10;
// Fetch the RSS feed with error handling
$rss = @simplexml_load_file($rss_feed_url);
if ($rss === false) {
echo 'Error: Unable to fetch RSS feed. Please check the feed URL or network connection.';
exit;
}
$post_content = '';
foreach ($rss->channel->item as $item) {
$title = (string)$item->title;
$link = (string)$item->link;
$description = (string)$item->description;
$post_content .= "$title\n\n$link\n\n$description\n\n";
}
if (!empty(trim($post_content))) {
global $vbulletin;
$post_data = array(
'threadid' => $thread_id,
'userid' => 1,
'username' => 'The one',
'title' => 'RSS Feed Update',
'pagetext' => $post_content,
'dateline' => TIMENOW,
'visible' => 1
);
// Sanitize user inputs
$username_safe = $vbulletin->db->escape_string($post_data['username']);
$title_safe = $vbulletin->db->escape_string($post_data['title']);
$pagetext_safe = $vbulletin->db->escape_string($post_data['pagetext']);
// Insert the post into the database
$vbulletin->db->query_write("
INSERT INTO " . TABLE_PREFIX . "post
(threadid, userid, username, title, pagetext, dateline, visible)
VALUES
({$post_data['threadid']}, {$post_data['userid']}, '$username_safe', '$title_safe', '$pagetext_safe', {$post_data['dateline']}, {$post_data['visible']})
");
} else {
echo 'Error: No valid content to post from RSS feed.';
}
?>



Comment