require_once (JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'helpers'.DS.'facebookhelper.php');
// Caption voorbeeld: '{*actor*} rated the lolcat 5 stars'
$message = "gaat naar " . $row->title;
$caption = "op " . date("d-m-Y", strtotime($row->begin));
$description = $row->shortdesc;
$url = "http://www.jozib.be/index.php?option=com_seminar&task=3&cid={$cid}&Itemid=68";
$action_links = array( array('text' => 'Go Jozib', 'href' => "http://www.jozib.be"));
$image_url = $row->image ? ("http://www.jozib.be/images/stories/seminar/" . $row->image) : null;
JFBConnectFacebookHelper::setWallMessage($message, $caption, $description, $url, $action_links, $image_url);
}function getFbLib()
{
if (self::$_FbRoot == null)
{
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jfbconnect'.DS.'assets'.DS.'facebook-api'.DS.'facebook.php');
$configModel = self::getConfigModel();
$facebookApiKey = $configModel->getSetting('facebook_api_key');
$facebookSecretKey = $configModel->getSetting('facebook_secret_key');
#echo "FBH. pre root user : ".self::$_OrigFbUser."";
[b]self::$_FbRoot = new Facebook($facebookApiKey, $facebookSecretKey);[/b]
self::$_OrigFbUser = self::$_FbRoot->user;
#echo "Key: ".self::$_FbRoot->api_client->session_key;
self::$_OrigFbSessionKey = self::$_FbRoot->api_client->session_key;
#echo "FBH. post root user : ".self::$_OrigFbUser."";
}
return self::$_FbRoot;
}function setWallMessage($message, $caption, $description, $url, $action_links = null, $image_url = null)
{
try
{
$fbClient = self::getFbClient(false);
if($fbClient->users_hasAppPermission("publish_stream"))
{
//$attachment = array('name' => $message, 'href' => $url);
$attachments = array();
if ($caption)
{
$attachment['caption'] = $caption;
}
if ($description)
{
$attachment['description'] = $description;
}
if ($image_url)
{
$attachment['media'] = array(array('type' => 'image', 'src' => $image_url, 'href' => $url));
}
$attachment = json_encode($attachment);
$action_links = json_encode($action_links);
$fbClient->stream_publish($message, $attachment, $action_links, null);
}
}$wallPost = array();
$wallPost['message] = $message;
if ($description)
$wallPost['description'] = $description;
if (any other values)...
$wallPost['otherValues'] = $otherValue;
require_once (JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php');
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
if ($jfbcLibrary->getUserId()) // Check if Facebook thinks there's a user logged in
$jfbcLibrary->setFacebookMessage($wallPost);function setWallMessage($message, $caption, $description, $url, $action_links = null, $image_url = null)
{
try
{
$fbClient = self::getFbClient(false);
//$attachment = array('name' => $message, 'href' => $url);
$attachments = array();
if ($caption)
{
$attachment['caption'] = $caption;
}
if ($description)
{
$attachment['description'] = $description;
}
if ($image_url)
{
$attachment['media'] = array(array('type' => 'image', 'src' => $image_url, 'href' => $url));
}
$attachment = json_encode($attachment);
$action_links = json_encode($action_links);
$fbClient->publish_stream($message, $attachment, $action_links, null);
}
catch (FacebookRestClientException $e)
{
/*
Fatal error: Uncaught exception 'FacebookRestClientException' with message
'Updating status requires the extended permission status_update' in
.../com_jfbconnect/assets/facebook-api/facebookapi_php5_restlib.php:3007
*/
}
}function setFacebookMessage($message, $caption, $description, $url, $action_links = null, $image_url = null)
{
if ($message)
if ($image_url)
{
$attachment['media'] = array(array('type' => 'image', 'src' => $image_url, 'href' => $url));
}
$attachment = json_encode($attachment);
$action_links = json_encode($action_links);
{
try
{
if (is_array($message))
$response = $this->api('/me/feed', $message, $attachment, $action_links, null);
else
$response = $this->api('/me/feed', array('message' => $message, $attachment, $action_links, null));
}
catch (JFBCFacebookApiException $e)
{
/*
Fatal error: Uncaught exception 'FacebookRestClientException' with message
'Updating status requires the extended permission status_update' in
.../com_jfbconnect/assets/facebook-api/facebookapi_php5_restlib.php:3007
*/
}
}
}if ($description)
$wallPost['description'] = $description;
if (any other values)...
$wallPost['otherValues'] = $otherValue;$wallPost = array();
$wallPost['message'] = "gaat naar " . $row->title;
$wallPost['description'] = $row->shortdesc;;
$wallPost['caption'] = "op " . date("d-m-Y", strtotime($row->begin));
$wallPost['url'] = "http://www.jozib.be/index.php?option=com_seminar&task=3&cid={$cid}&Itemid=68";
$wallPost['image_url'] = $row->image ? ("http://www.jozib.be/images/stories/seminar/" . $row->image) : null;
$wallPost['action_links'] = array( array('text' => 'Go Jozib', 'href' => "http://www.jozib.be"));
require_once (JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php');
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
if ($jfbcLibrary->getUserId()) // Check if Facebook thinks there's a user logged in
$jfbcLibrary->setFacebookMessage($wallPost);$wallPost = array('message' => "gaat naar " . $row->title,
'caption' => "op " . date("d-m-Y", strtotime($row->begin)),
'link' => "http://www.jozib.be/index.php?option=com_seminar&task=3&cid={$cid}&Itemid=68",
'description' => $row->shortdesc,
'picture' => $row->image ? ("http://www.jozib.be/images/stories/seminar/" . $row->image) : null,
'actions' => array(array('name' => 'Go Jozib', 'link' => "http://www.jozib.be")));
require_once (JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php');
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
if ($jfbcLibrary->getUserId()) // Check if Facebook thinks there's a user logged in
$jfbcLibrary->setFacebookMessage($wallPost);Join our newsletter to get alerts for Joomla releases, tips and tricks and extension updates.
