I wonder if anyone has some ideas on this... I (and a few others) are trying to get AME to work on posts that are made via an RSS feed.
For example if you have a youtube RSS feed you need to "edit" and "save" each post for the video to actually embed.
I am close to solving this, I think, but still not working.
I have edited the file rssposter.php in the includes/cron/ directory... Since there are no hooks.
Find this code:
PHP Code:
$rsslog_insert_sql[] = "($item[rssfeedid], $itemid, '$itemtype', '" . $vbulletin->db->escape_string($uniquehash) . "', '" . $vbulletin->db->escape_string($item['contenthash']) . "', " . TIMENOW . ", $threadactiontime)";
$cronlog_items["$item[rssfeedid]"][] = "\t<li>$vbphrase[$itemtype] <a href=\"$itemlink\" target=\"logview\"><em>$itemtitle</em></a></li>";
}
And right after it add:
PHP Code:
//Set AME Flag Start
require_once(DIR . '/includes/functions.php');
$amethread = fetch_threadinfo($itemid);
$postid = $amethread['firstpostid'];
$post = fetch_postinfo($postid);
$post['message'] = $post['pagetext'];
require_once(DIR . '/includes/ame_bbcode.php');
$value = ame_prep_text($post['message']);
echo $post['message'];
if ($value == 1)
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET pagetext ='" . $vbulletin->db->escape_string($post['message']) . "', ame_flag=1 WHERE postid=$post[postid]");
}
else if ($value == 2)
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET pagetext ='" . $vbulletin->db->escape_string($post['message']) . "', ame_flag=1 WHERE postid=$post[postid]");
}
//Set AME Flag End
This code will set the ame_flag to "1" in the database for the post but for some reason does NOT change the [url] bbcode to [ame]...
I use the same query for both value ==1 and ==2 because "2" I believe disables AME in the post, which I don't want- I will assume for every RSS post I want it enabled, so I set the flag to 1 in both cases.
Is there something else I am missing? Do I need to run something else besides ame_prep_text?
Maybe there is supposed to be some difference between $post[message] and $post[pagetext] that I am missing... ?