I can't find where the save function does onContentAfterSave.
This is my code. It saves the article but doesn't trigger onContentAfterSave, or at least if it does JBFC doesn't post to FB.
function PublishArticle ($title,$introtext,$today)
{
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
$new_article = new ContentModelArticle();
$data = array(
'title' => $title,
'introtext' => $introtext,
'state' => 1,
'catid' => 20,
'created' => $today,
'created_by' => 68,
'language' => "en-GB",
'publish_up' => $today,
'access' => 1,
'featured' => 0,
'metadata' => array(
'robots' => "",
'author' => "",
),
);
if ($result = $new_article->save($data))
{
$dispatcher->trigger('onContentAfterSave', array('com_content.article', $result, true));
}
}