First Steps with Flow-Flow PHP Script

Assume that you installed and activated Flow-Flow plugin as described in  Installation and Requirements article. Let's access Admin Panel and setup our first Stream. 

Accessing admin panel of Flow-Flow

Example file admin.php demonstrates that you can add Flow-Flow admin on any page. You can use this file like described in Installation and Requirements to access Flow-Flow admin like standalone page as soon as you place plugin folder on server.

Below you can find the necessary instructions how to inject Flow-Flow panel to any page:

  1. Open PHP template of admin’s page where you want to have Flow-Flow panel.
  2. In the beginning of file add this code: <?php require_once(&#39;PATH_TO_PLUGIN_FOLDER/flow-flow/ff-injector.php&#39;); $injector = new FFInjector(true); ?> PATH_TO_PLUGIN_FOLDER is absolute or relative location of flow-flow in site filesystem
  3. Then add next code between <head></head> tags to add plugin's CSS and JS <?php echo $injector->head(true, false, true); ?> Refer to Injector Documentation to find out parameters you can pass in API methods.
  4. And finally add this code where you want to have Flow-Flow panel on page <?php $injector->admin("Flow-Flow - Social Streams Plugin"); ?>

You can open in editor file admin.php and see how all these steps are implemented in it.

Authenticate your Flow-Flow with Social Network

Some social networks require auth keys before you can pull any content from there. At the time of this writing authentication is necessary for Facebook, Twitter, Instagram, Google+ and Foursquare. If you want to stream content from any of these networks you need to setup it accordingly to specific SN terms. This settings must be stored under AUTH tab of Flow-Flow. We strongly recommend to start with this step.

Important article: Auth Setup Guides

Creating your first Stream

  1. Make sure Streams tab is active on admin page.
  2. Click Add Stream button. We'll be moved to new Stream's settings page.
  3. Start with naming your stream and adding first feed to your Stream.
  4. Click the button Add social feed.
  5. Choose social network and setup feed accordingly to simple rules in hints. Don't ignore them because it's the part of common mistakes.
  6. Click Add feed. We'll be moved back to Stream's settings page. Now you can see that you have your first feed associated with current Stream.
  7. Back to streams list view and see that stream was added and has unique ID. You will use this ID to add stream on page.

Adding your Stream on page

The steps are very similar to admin page injections. Here are these steps:

  1. Open PHP template of site’s page where you want to have social stream you created.
  2. In the beginning of file add this code: <?php require_once(&#39;PATH_TO_PLUGIN_FOLDER/flow-flow/ff-injector.php&#39;); $injector = new FFInjector(); ?> PATH_TO_PLUGIN_FOLDER is absolute or relative location of flow-flow in site filesystem
  3. Then add next code between <head></head> tags to add plugin's CSS and JS <?php echo $injector->head(true, false); ?> Refer to Injector Documentation to find out parameters you can pass in API methods.

  4. And finally add this code where you want to have stream on page <?php $injector->stream(1); ?> The number in parenthesis is stream ID.

You can open in editor file index.php and see how all these steps are implemented in it.

Refreshing Stream content

Because plugin caches data there must be mechanism to refresh this cache and update content. Special URL needs to be requested for this and it will refresh content. There are several ways to reach this URL. You can set second parameter to true in Injector method used for stream injection like this <?php echo $injector->head(true, true); ?> Then anytime someone visits the page he/she will initiate stream's update. The only drawback is that this specific user will see new content only after refreshing page.

The better way is to create background server Cron job. Please ask your hosting support to create it for you and give them this command that needed to executed every 5 min: /usr/bin/curl -L -o /dev/null http://domain.com/PATH_TO_PLUGIN_FOLDER/flow-flow/ff.php?action=refresh_cache You can create Cron job by yourself if your domain admin panel supports this.