/** * Format and publish a FeedItem object owned by the given User to the Facebook stream * * @param FeedItem $item * @param bigint target_id - (optional) The Facebook ID of the user, Page, or event where you are publishing the content. * @return bool */ public static function publishFeedItem(FeedItem $item, $target_id = null) { // for correct link building and tracking $item->setBaseNetwork(self::getNetwork()); // if there's no stream data for this feed type on this network, we're done if (!($data = $item->getStreamData())) { return null; } // try publishing try { // this will return the post ID if it's successful // $message, $attachment = null, $action_links = null, $target_id = null, $uid = null $result = self::getClient()->api_client->stream_publish($data['message'], $data['attachment'], $data['action_links'], $target_id); } catch (Exception $ex) { self::log('facebook ------' . $ex->getMessage()); $result = false; } // post ID string or FALSE return $result; }