WordPress.org

Ready to get started?Download WordPress

Forums

Recent Facebook Posts
[resolved] Patch for adding links (2 posts)

  1. ravloony
    Member
    Posted 1 year ago #

    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/

  2. Danny van Kooten
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Ravloony,

    I will include the 'link' post type in the next plugin update as well. Thanks. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic