PDA

View Full Version : Duplicate Post checker for Inferno RSS Forum Feeds Technology v1.6


flup
11-11-2007, 10:00 PM
Credits go to Zero Tolerance for making this hack available for vB 3.5.0 a while back ;) I just added 2 lines of code which must be enough to keep the doubles away ;)

Inferno RSS Forum Feed Technology v1.6:
https://vborg.vbsupport.ru/showthread.php?t=94510

------------------------------------------------------------------------------------------

I noticed a lot of users where complaining about the doublepost being made by the RSS feed reader. As there are still alot of users who have installed this hack, underwhich myself, I have made a slight modification for this hack which checks the new posts for titles in the database.

It's a fairly easy modification and it might not be the perfect solution to this problem, but at least it keeps the double posts away.

What does it do?
This mod checks for posts with the same title in the forum where the feed is directed to (so a a feed which is posted in the forum with ID 3 will only check for duplicate titles in the forum with ID 3).

What to do?
Open the /includes/class_ffrss.php file and find the function: post_thread() and replace it with this new post_thread function:

function post_thread($title, $message, $feed)
{
global $vbulletin;

$getThread = $vbulletin->db->query("SELECT threadid FROM " . TABLE_PREFIX ."thread WHERE title = '" . mysql_real_escape_string($title) . "' AND forumid = '" . mysql_real_escape_string($feed['feed_forum']) . "'");
$ThreadNums = $vbulletin->db->num_rows($getThread);

if($ThreadNums < 1) {

$this->ItemsAdded++;

$newpost['title'] = $title;
$newpost['message'] = $message;
$smilie = true;
$foruminfo = fetch_foruminfo($feed['feed_forum']);

$ThreadDM =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');

$ThreadDM->set_info('forum', $foruminfo);
$ThreadDM->set_info('thread', $newpost);
$ThreadDM->setr('allowsmilie', $smilie);
$ThreadDM->setr('userid', $feed['feed_user']);
$ThreadDM->setr('title', $newpost['title']);
$ThreadDM->setr('pagetext', $newpost['message']);
$ThreadDM->setr('forumid', $feed['feed_forum']);
$ThreadDM->setr('dateline', $this->get_dateline());
$ThreadDM->set('visible', 1);
$ThreadDM->registry->options['floodchecktime'] = 0; // Disable flood check in memory...
$ThreadDM->pre_save();

if (sizeof($ThreadDM->errors) > 0)
{
$ThreadDM->errors = array();
}

$ThreadDM->save();

}

}

Hopefully it works for everyone :)

flup
11-12-2007, 03:04 PM
Please let me know wether this solution works.. as far as I can see it works like a charm on my forums.

Xeder
11-13-2007, 08:46 AM
I can't even find /includes/class_ffrss.php :/
Help?

flup
11-13-2007, 09:21 PM
If you have installed the Inferno RSS Forum Feed Technology mod properly, and you have uploaded all files to the correct directories in:

forumdirectory/includes/

You will find the class_ffrss.php file.. might need a little search, but it definitly should be there otherwise the whole Inferno RSS mod couldn't work.

legion!
03-15-2009, 12:12 AM
Hmm does this work for 3.8 i kinda need this

MedellinStyle
05-09-2010, 07:51 PM
this works with 4.xx ??

Naijasite
02-28-2013, 06:32 PM
does it work with 4.2.0