New Community Forums are coming. Watch this space for news.
Subscribe: RSS
  • Does anyone know if there are any plugins for adding a facebook stream/feed (from a Facebook Group) to MODX Revo. I want to display the latest 5 posts from the group on my website, but am not sure what the best way of approaching this is - any ideas?? Many thanks
    • As far as I know there is no extension available to do that.

      I remember a plugin that can push messages to facebook, SimiusPush. Thats the other way around, but it should be depending on the same API. Google it as I can't find it in the repository.

      The good news is: It's fairly easy to do that using the facebook API.

      The php SDK can be found here:
      https://github.com/facebook/facebook-php-sdk

      And an official facebook documentation there:
      https://developers.facebook.com/docs/reference/php/

      For a tutorial ask google. There are plenty of them.

      BUT be careful. Tell your client that facebook, twitter, etc are changing their API every once in a while and sooner or later you have to do some additional work (and charge for it smiley ) to keep up with new "features".

      I'm head over heals in a project and already behind with MODX related community stuff. If it is not very urgent, I can send you some snippets I wrote about a year ago in about two weeks. I don't want to give them away as they are right now, but If I find the time to clean up some stuff, I'll gladly give he away.

      Regards,

      pepebe [ed. note: pepebe last edited this post 5 years ago.]
        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
      • Michael Engel Reply #3, 5 years ago
        I would suggest you to use the XML Feeds and something like the Package getFeed, maybe this is available for the data you are wanting to display.
        The API Tokens run out and have to be refreshed manually with your Facebook login.

        We are using something like that for some Sites:
        [[!getFeed? &url=`http://www.facebook.com/feeds/page.php?format=rss20&id=1234567` &tpl=`facebookRowTpl`]]


        • fourroses666 Reply #4, 5 years ago
          I tried https://neosmart-stream.de/ some time ago but couldn't get it working that great.
            Evolution user, I like the back-end speed and simplicity smiley
          • Hello Emliy

            I did following, useing Facebook Graph and you need a Facebook Developer Account. Additionally, the FB User has to set the proper access settings, in order to get access to the posts (Below I get the 5 most recent posts) and you need to setup a chunk for displaying the results):

            <?php
            $contents = $modx->cacheManager->get('facebook_graph');
            
            if($contents === NULL) {
            
                $access_url = "https://graph.facebook.com/oauth/access_token?client_id=!!!!YOUR CLIEND ID!!!!&client_secret=!!!! YOUR CLIENT SECRET!!!!&grant_type=client_credentials";
                
                $access_token = file_get_contents($access_url);
                $access_token = explode("=", $access_token);
                $access_token = $access_token[1];
                
                
                $url = "https://graph.facebook.com/!!!HERE YOUR FACEBOOK NUMBER!!!!/posts?limit=5&access_token=$access_token&method=GET&locale=de_DE";
            
                $contents = file_get_contents($url);
                $contents = utf8_encode($contents);
                $modx->cacheManager->set('facebook_graph', $str, 7200);
            }
            
            $results = json_decode($contents);
            
            $output = "";
            
            
            foreach($results->data as $post) {
            
            
                $properties = array();
                
            
                
                $properties["message"] = $post->message;
                $properties["picture"] = $post->picture;
                $properties["link"] = $post->link;
                $properties["source"] = $post->source;
                $properties["name"] = $post->name;
                $properties["caption"] = $post->caption;
                $properties["description"] = $post->description;
                $properties["icon"] = $post->icon;
                $properties["story"] = $post->story;
                $properties["created_time"] = $post->created_time;
                $properties["type"] = $post->type;
                $properties["action_link"] = $post->actions;
            
                $output .= $modx->getChunk($tpl,$properties);
            }
            
            return $output;


            Hope it helps
            /toni
            • Thank you very much, Toni. This is very helpful and works fine.

              Does anyone have an idea how I can show the full-size image of a post? Not the property "picture" as this is limited to 100px.

              Thank you
              Gudrun
              • Hello,

                There are several ways to integrate Facebook page to your website. You can use standard Facebook plugin, but in my opinion it’s not the best decision ‘cos it’s not fully customizable and looks a bit outdated. I would recommend you to try out this plugin: https://elfsight.com/facebook-feed-widget/. I use it for about a six month and happy with it. You can customize it and place to the site, there is an option “posts limit”, you can use it to show only 5 latest posts.

                You can work with images too.

                Hope it helps.