I'm working on getting this to work and wondered if anyone else out there has already tackled this.
I think I've found the code that handles the rss feed, but I'm not sure of the syntax I should use to display the avatars in the xml feed.
Any help would be awesome!
Here's the area that we'll need to add some code to, to make it work:
PHP Code:
case 'RSS':
$xml->add_group('item');
$xml->add_tag('title', unhtmlspecialchars($thread['title']));
$xml->add_tag('link', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]&goto=newpost", array(), false, true);
$xml->add_tag('description', "$vbphrase[forum]: " . unhtmlspecialchars($vbulletin->forumcache["$thread[forumid]"]['title_clean']) . "\r\n$vbphrase[posted_by]: " . unhtmlspecialchars($thread['postusername']) . "\r\n" .
construct_phrase($vbphrase['post_time_x_at_y'], vbdate($vbulletin->options['dateformat'], $thread['dateline']), vbdate($vbulletin->options['timeformat'], $thread['dateline'])));
$xml->close_group('item');
break;
case 'RSS1':
$xml->add_group('item', array('rdf:about' => $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]"));
$xml->add_tag('title', unhtmlspecialchars($thread['title']));
$xml->add_tag('link', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]&goto=newpost", array(), false, true);
$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$plainmessage = $plaintext_parser->parse($thread['message'], $thread['forumid']);
unset($plaintext_parser);
if ($vbulletin->GPC['fulldesc'])
{
$xml->add_tag('description', $plainmessage);
}
else
{
$xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview']));
}
if (!$vbulletin->GPC['nohtml'])
{
$thread['attachments'] =& $attachmentcache["$thread[threadid]"];
$forumperms = fetch_permissions($thread['forumid']);
$postbit_factory->thread =& $thread;
$postbit_factory->cache = array();
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']))
{
$vbulletin->options['viewattachedimages'] = 0;
$vbulletin->options['attachthumbs'] = 0;
}
else
{
$vbulletin->options['viewattachedimages'] = $viewattachedimages;
$vbulletin->options['attachthumbs'] = $attachthumbs;
}
$postbit_obj =& $postbit_factory->fetch_postbit('external');
$message = $postbit_obj->construct_postbit($thread);
$xml->add_tag('content:encoded', $message);
}
$xml->add_tag('dc:date', gmdate('Y-m-d\TH:i:s', $thread['dateline']) . 'Z');
$xml->add_tag('dc:creator', unhtmlspecialchars($thread['postusername']));
$xml->add_tag('dc:subject', unhtmlspecialchars($vbulletin->forumcache["$thread[forumid]"]['title_clean']));
$xml->close_group('item');
break;
case 'RSS2':
$xml->add_group('item');
$xml->add_tag('title', unhtmlspecialchars($thread['title']));
$xml->add_tag('link', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]&goto=newpost", array(), false, true);
$xml->add_tag('pubDate', gmdate('D, d M Y H:i:s', $thread['dateline']) . ' GMT');
$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$plainmessage = $plaintext_parser->parse($thread['message'], $thread['forumid']);
unset($plaintext_parser);
if ($vbulletin->GPC['fulldesc'])
{
$xml->add_tag('description', $plainmessage);
}
else
{
$xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview']));
}
if (!$vbulletin->GPC['nohtml'])
{
$thread['attachments'] =& $attachmentcache["$thread[threadid]"];
$forumperms = fetch_permissions($thread['forumid']);
$postbit_factory->thread =& $thread;
$postbit_factory->cache = array();
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']))
{
$vbulletin->options['viewattachedimages'] = 0;
$vbulletin->options['attachthumbs'] = 0;
}
else
{
$vbulletin->options['viewattachedimages'] = $viewattachedimages;
$vbulletin->options['attachthumbs'] = $attachthumbs;
}
$postbit_obj =& $postbit_factory->fetch_postbit('external');
$message = $postbit_obj->construct_postbit($thread);
$xml->add_tag('content:encoded', $message);
unset($message);
}
$xml->add_tag('category', unhtmlspecialchars($vbulletin->forumcache["$thread[forumid]"]['title_clean']), array('domain' => $vbulletin->options['bburl'] . "/forumdisplay.php?f=$thread[forumid]"));
$xml->add_tag('dc:creator', unhtmlspecialchars($thread['postusername']));
$xml->add_tag('guid', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]", array('isPermaLink' => 'true'));
if ($vbulletin->options['rsspodcast'] AND $podcastinfo)
{
$xml->add_tag('itunes:explicit', $thread['explicit'] == 1 ? 'yes' : 'no');
if ($thread['keywords'])
{
$xml->add_tag('itunes:keywords', $thread['keywords']);
}
if ($thread['subtitle'])
{
$xml->add_tag('itunes:subtitle', $thread['subtitle']);
}
if ($thread['author'])
{
$xml->add_tag('itunes:author', $thread['author']);
}
if ($thread['url'])
{
switch(file_extension($thread['url']))
{
case 'mp3':
$type = 'audio/mpg';
break;
case 'm4a':
$type = 'audio/x-m4a';
break;
case 'mp4':
$type = 'video/mp4';
break;
case 'm4v':
$type = 'video/x-m4v';
break;
case 'mov':
$type = 'video/quicktime';
break;
case 'pdf':
$type = 'application/pdf';
break;
default:
$type = 'unknown/unknown';
}
$xml->add_tag('enclosure', '', array(
'url' => $thread['url'],
'length' => $thread['length'],
'type' => $type
));
}
else if ($attachmentcache["$thread[threadid]"])
{
$type = 'unknown/unknown';
$attach = array_shift($attachmentcache["$thread[threadid]"]);
$mimetype = unserialize($attach['mimetype']);
foreach ($mimetype AS $header)
{
if (preg_match('#Content-type:(.*)$#si', $header, $matches))
{
$type = trim($matches[1]);
break;
}
}
if ((strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' AND stristr($_SERVER['SERVER_SOFTWARE'], 'apache') === false) OR (strpos(SAPI_NAME, 'cgi') !== false AND @!ini_get('cgi.fix_pathinfo')))
{
$filename = $vbulletin->options['bburl'] . "/attachment.php?attachmentid=$attach[attachmentid]&dateline=$attach[dateline]&filename=" . urlencode($attach['filename']);
}
else
{
$filename = $vbulletin->options['bburl'] . "/attachment.php/$attach[attachmentid]/" . urlencode($attach['filename']);
}
$xml->add_tag('enclosure', '', array(
'url' => $filename,
'length' => $attach['filesize'],
'type' => $type
));
}
}
$xml->close_group('item');
break;
}
}
}