Support » Plugin: Recent Facebook Posts » Patch for adding links

  • Resolved ravloony

    (@ravloony)


    Hi,

    I had an issue with this plugin that apparently it was not showing recent posts. It turned out that it was only getting “status”, “photo” and “video” post types, not “link” ones.

    So I added the code for that:

    --- a/classes/class-rfb.php
    +++ b/classes/class-rfb.php
    @@ -125,12 +125,12 @@ class RFB {
                    if(!$fb->getUser()) return false;
    
                    $apiResult = $fb->api(trim($opts['fb_id']) . '/feed?with=message&limit=250');
    -
    +
                    if(!$apiResult or !is_array($apiResult) or !isset($apiResult['data']) or !is_array($apiResult['data'])) { return false; }
    
                    $data = array();
                    foreach($apiResult['data'] as $p) {
    -                       if(!in_array($p['type'], array('status', 'photo', 'video'))) { continue; }
    +                       if(!in_array($p['type'], array('status', 'photo', 'video','link'))) { continue; }
                            //split user and post ID (userID_postID)
                            $idArray = explode("_", $p['id']);
    
    @@ -143,6 +143,12 @@ class RFB {
                            } elseif($p['type'] == 'video') {
                                    $post['image'] = $p['picture'];
                                    $post['content'] .= "\n\n {$p['link']}";
    +                       } elseif($p['type'] == 'link') {
    +                                                                if (isset($p['picture']))
    +                               $post['image'] = $p['picture'];
    +                                                                if (isset($p['description']))
    +                               $post['content'] .= "\n\n {$p['description']}";
    +                                                                $post['content'] .= "\n\n {$p['link']}";
                            } else {
                                    $post['image'] = null;
                            }

    Best regards,

    http://wordpress.org/extend/plugins/recent-facebook-posts/

Viewing 1 replies (of 1 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Ravloony,

    I will include the ‘link’ post type in the next plugin update as well. Thanks. 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Patch for adding links’ is closed to new replies.