Skip to content

Instantly share code, notes, and snippets.

@e0ipso
Last active December 21, 2015 05:19
Show Gist options
  • Save e0ipso/6256142 to your computer and use it in GitHub Desktop.
Save e0ipso/6256142 to your computer and use it in GitHub Desktop.
Use FBAutopost wrapper class to publish to the user's timeline (requires Facebook App approval).
<?php
try {
$fb = facebook_autopost();
$fb
->setDestination('me')
->publish(array(
'type' => 'status',
'params' => array('message' => t('Hello world.')),
));
}
catch (ErrorException $e) {
drupal_set_message($e->getMessage(), 'error');
}
?>
@drasgardian
Copy link

This should call the factory function facebook_autopost() instead of instantiating FBAutopost directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment