Hi,
ok... I have to say that i'm really pissed because i ordered the JA Extension Plan years ago and downloaded JA Social Feed.. Now it wasn't working anymore so i renewed the subscription to get the latest version. The newest Version didn't work either so i had to fix it myself. That wasn't the plan...
For all of you who use this Plugin, just follow my simple steps to hotfix the issue:
Replace the following code in the main PHP File: "plugins/system/jasocial_feed/jasocial_feed.php" (Line 530 - 590):
//IMPORT PROCESS
$fbKey = $fbid.'_';
$last_insert_id = isset($this->aInfo[$fbKey.'fb_last_id']) ? $this->aInfo[$fbKey.'fb_last_id'] : '';
$fetchUrl = $this->https."://graph.facebook.com/v3.0/".$fbid."/posts?fields=attachments,permalink_url,object_id,name,story,id,from{id,name},message,created_time,updated_time,type,link,description,picture,full_picture&access_token=".$access_token."&limit=".$limit;
$content = json_decode($this->getContent($fetchUrl));
if (!empty($content->error)) {
return '<pre>' . print_r($content->error->message, 1) . '</pre>';
}
$data = $content->data;
$items = array();
foreach ( $data as $item) {
if (!is_object($item)) {
break;
}
$dt = new stdClass();
if (!empty($item->message)) {
$dt->title = $this->cutTitleFromContent($item->message, $titleMaxLen);
} else if ( !empty($item->story)) {
$dt->title = $item->story;
} else {
$dt->title = $item->type;
}
$dt->id = str_replace($fbid.'_','',$item->id);
$dt->object_id = !empty($item->object_id) ? $item->object_id : '';
$dt->name = !empty($item->name) ? $item->name : '';
$dt->link = isset($item->link) ? $item->link : '';
$dt->desc = '';
$dt->type = $item->type;
$dt->permalink_url = $item->permalink_url;
$dt->full_picture = !empty($item->full_picture) ? $item->full_picture : '';
$dt->attachments = !empty($item->attachments) ? $item->attachments : '';
if(isset($item->message)){
$dt->desc .= $item->message;
}else if(!isset($item->message)){
if(isset($item->description)){
$dt->desc .= $item->description;
}
}
$pattern1 = '/(https|http):\/\/.*/';
preg_match_all($pattern1,$dt->desc,$matches);
if(count($matches[0]) > 0){
foreach($matches[0] as $matche){
$dt->desc = str_replace($matche, '<a href="'.$matche.'">'.$matche.'</a>', $dt->desc);
}
}
// if(isset($item->picture)){
// $dt->desc .= "\n <img src=\"".$item->picture."\" />";
// }
$dt->pubDate = $item->created_time;
$dt->author = $item->from->name;
$dt->img = isset($item->picture) ? $item->picture : '';
$items[] = $dt;
}
with my new code:
//IMPORT PROCESS
$fbKey = $fbid.'_';
$last_insert_id = isset($this->aInfo[$fbKey.'fb_last_id']) ? $this->aInfo[$fbKey.'fb_last_id'] : '';
$fetchUrl = $this->https."://graph.facebook.com/v3.3/".$fbid."/posts?fields=attachments{title,url_unshimmed,description,media_type,media,target,type,url},permalink_url,story,id,from{id,name},message,created_time,updated_time,picture,full_picture&access_token=".$access_token."&limit=".$limit;
$content = json_decode($this->getContent($fetchUrl));
if (!empty($content->error)) {
return '<pre>' . print_r($content->error->message, 1) . '</pre>';
}
$data = $content->data;
$items = array();
foreach ( $data as $item) {
if (!is_object($item)) {
break;
}
$dt = new stdClass();
if (!empty($item->message)) {
$dt->title = $this->cutTitleFromContent($item->message, $titleMaxLen);
} else if ( !empty($item->story)) {
$dt->title = $item->story;
} else {
$dt->title = $item->attachments->data[0]->media_type;
}
$dt->id = str_replace($fbid.'_','',$item->id);
$dt->object_id = !empty($item->attachments->data[0]->target->id) ? $item->attachments->data[0]->target->id : '';
$dt->name = !empty($item->attachments->data[0]->title) ? $item->attachments->data[0]->title : '';
$dt->link = isset($item->attachments->data[0]->url_unshimmed) ? $item->attachments->data[0]->url_unshimmed : '';
$dt->desc = '';
$dt->type = $item->attachments->data[0]->media_type;
$dt->permalink_url = $item->permalink_url;
$dt->full_picture = !empty($item->full_picture) ? $item->full_picture : '';
$dt->attachments = !empty($item->attachments) ? $item->attachments : '';
if(isset($item->message)){
$dt->desc .= $item->message;
}else if(!isset($item->message)){
if(isset($item->attachments->data[0]->description)){
$dt->desc .= $item->attachments->data[0]->description;
}
}
$pattern1 = '/(https|http):\/\/.*/';
preg_match_all($pattern1,$dt->desc,$matches);
if(count($matches[0]) > 0){
foreach($matches[0] as $matche){
$dt->desc = str_replace($matche, '<a href="'.$matche.'">'.$matche.'</a>', $dt->desc);
}
}
// if(isset($item->picture)){
// $dt->desc .= "\n <img src=\"".$item->picture."\" />";
// }
$dt->pubDate = $item->created_time;
$dt->author = $item->from->name;
$dt->img = isset($item->picture) ? $item->picture : '';
$items[] = $dt;
}
Also please make sure to set the API Version in your FB-App to "3.3"
Regards