2017 © Pedro Peláez
 

silverstripe-module silverstripe-social-feed

A social feed module for fetching content from Facebook and Twitter

image

isaacrankin/silverstripe-social-feed

A social feed module for fetching content from Facebook and Twitter

  • Wednesday, May 31, 2017
  • by isaacrankin
  • Repository
  • 1 Watchers
  • 5 Stars
  • 1,050 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 3 Open issues
  • 1 Versions
  • 4 % Grown

The README.md

SilverStripe Social Feed

Combine social media posts from Facebook, Twitter and Instagram into a single feed. Each feed is available separately also., (*1)

Installation

composer require isaacrankin/silverstripe-social-feed, (*2)

Usage

<% include SocialFeed %>, (*3)

Alternatively you can call the SocialFeed method directly like so:, (*4)

<div class="social-feed">
    <ol>
        <% loop SocialFeed %>
            <li>
                <a href="$URL" target="_blank">
                    <h4>Type: $Type</h4>
                    <p>Created: $Created</p>
                    <p>User: $UserName</p>
                    <p><img src="$Image" /></p>
                    <p>$Content</p>
                </a>
            </li>
        <% end_loop %>
    </ol>
</div>

The posts are ordered from newest to oldest., (*5)

Within the SocialFeed control loop the following values are available:, (*6)

  • $URL - a URL for the social media post
  • $Type - the type of post, either "facebook", "twitter" or "instagram"
  • $Created - the creation/posted date of the post
  • $UserName - the user who made the post
  • $Image - the main image for the post
  • $Data - all of the data for a single post in the original structure returned from the API's. Read documentation for the API's to see what's available.

Caching

All SocialMediaProvider::getFeed() calls are cached for 15 minutes and can be cleared either in the CMS or by appending ?socialfeedclearcache=1 in developer mode., (*7)

There is also a SocialFeedCacheTask that you can setup as a cronjob on your server to ensure that the end-user never has to wait for your server to make its API calls to Facebook, Twitter, etc and update the various social feed caches., (*8)

Alternatively, if you're using the QueuedJobs module, this process will be handled automatically for you, as a queued job is setup to update the cache every 10 minutes., (*9)

Requirements

SilverStripe 4 or newer, (*10)

Twitter

The Twitter data is a collection of the most recent Tweets posted by the user. The following API endpoint is used https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi, (*11)

Twitter API documentation for user timeline, (*12)

Credentials

You'll need to create a Twitter app here https://apps.twitter.com/app/, (*13)

Facebook

The Facebook data returned is the most recent posts for a given Facebook Page. The following API endpoint is used https://graph.facebook.com/PAGE_ID/feed?access_token=ACCESS_TOKEN, (*14)

Facebook API documentation, (*15)

Credentials

To get the necessary Facebook API credentials you'll need to create a Facebook App., (*16)

Instagram

The most recent media published for a user. The following API endpoint is used https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS_TOKEN Instagram API documentation for resent user media, (*17)

Credentials

To get the necessary Instagram API credentials you'll need to create an Instagram Client., (*18)

You'll need to add the correct redirect URI in the settings for the Instagram App, such as http://yoursite.com/admin/social-feed/SocialFeedProviderInstagram/, (*19)

The Versions

31/05 2017

dev-master

9999999-dev http://github.com/isaacrankin/silverstripe-social-feed

A social feed module for fetching content from Facebook and Twitter

  Sources   Download

BSD-3-Clause

The Requires

 

by Isaac Rankin

facebook silverstripe instagram twitter social feed