AndrewRich
07-10-2012, 10:30 PM
I'm trying to implement a source blocklist for our RSS feeds - we get newsfeeds from Google News and rather than trying to figure out Google's broken news-source nomenclature, I will just block items from unwanted sources from posting. I'm hooking rssposter_parse_rss and have defined a blocklist as $vbulletin->options['rssitemsourcefilter_blacklist']. Here's my plugin code so far:
global $vbulletin;
if ( $vbulletin->options['rssitemsourcefilter_enabled']) {
$blacklistA = preg_split ( '/\s+/', $vbulletin->options['rssitemsourcefilter_blacklist'] );
foreach ( $blacklistA as $blacklist ) {
if ( stripos ( $item['link'], $blacklist ) !== FALSE ) {
// link source appears in blacklist
if (defined('IN_CONTROL_PANEL')) {
echo "<p>RSS feed item with source {$blacklist} was blocked.</p>";
}
$item = NULL; // nullify the RSS item
} // if
} // foreach
} // if
This does "empty out" the particular RSS item but it doesn't actually remove it from the queue, so instead a blank entry with a no-destination "more" link is posted. I've been going through /includes/class_rss_poster.php and /includes/cron/rssposter.php to try to figure out how to actually remove the offending item, but without any luck.
Any help appreciated. Thanks.
global $vbulletin;
if ( $vbulletin->options['rssitemsourcefilter_enabled']) {
$blacklistA = preg_split ( '/\s+/', $vbulletin->options['rssitemsourcefilter_blacklist'] );
foreach ( $blacklistA as $blacklist ) {
if ( stripos ( $item['link'], $blacklist ) !== FALSE ) {
// link source appears in blacklist
if (defined('IN_CONTROL_PANEL')) {
echo "<p>RSS feed item with source {$blacklist} was blocked.</p>";
}
$item = NULL; // nullify the RSS item
} // if
} // foreach
} // if
This does "empty out" the particular RSS item but it doesn't actually remove it from the queue, so instead a blank entry with a no-destination "more" link is posted. I've been going through /includes/class_rss_poster.php and /includes/cron/rssposter.php to try to figure out how to actually remove the offending item, but without any luck.
Any help appreciated. Thanks.