2017 © Pedro Peláez
 

newscoop-plugin facebook-newscoop-bundle

Usefull sevices for integration Newscoop and Facebook

image

nalyk/facebook-newscoop-bundle

Usefull sevices for integration Newscoop and Facebook

  • Thursday, August 25, 2016
  • by nalyk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Facebook plugin for Newscoop

Features

  • Facebook caches shared URLs for better performance. This can cause problems when we want to change the title or description of a Newscoop article, because Facebook still has the older version. This plugin is designed to fix the problem by clearing the article cache on Facebook and updating Open Graph tags.
  • This plugin also provides an easy way to generate all required Open Graph tags with a simple template block.
  • Newscoop provides a way to schedule article publishing in advance, but before publishing the article you can't plan the announcement on Facebook, as Facebook won't fetch article metadata. This plugin exposes a special URL for the Facebook crawler so that you can plan posts with scheduled articles. This URL will redirect readers to the real articles when those scheduled articles are published.

Installation

Step 1:

In the Newscoop server console, run the command: ``` bash $ php application/console plugins:install "newscoop/facebook-newscoop-bundle" --env=prod, (*1)

This plugin will be installed to the `newscoop/plugins/Newscoop` directory.

### Step 2:
Go to an article edit page in Newscoop to see the Facebook Plugin on the right sidebar.

Also read more about [Lifecycle Subscriber Managing](https://wiki.sourcefabric.org/display/NPS/Lifecycle+Subscriber+Managing).

**Database table for the plugin** 

This plugin has only one entity: `Facebook.php`. After the plugin is installed, your Newscoop database will have a new table: `plugin_facebook_informations`.

This table keeps information from Facebook about an article, such as:

- `article` - article ID
- `language` - article's language ID
- `title` - article title
- `description` - article description
- `created_at` - date when information was added
- `is_active` - information status

**Generating Open Graph tags using a Smarty plugin**

In the `Newscoop/FacebookNewscoopBundle/Resources/smartyPlugins` directory you will find the file: `block.facebook_meta_block.php`

This file is a Facebook metadata block plugin. It generates the Facebook Meta information for a page. The Smarty plugin will be automatically autoloaded and available in your templates.

To test and display metadata generated by the Smarty plugin just put this block into `_html-head.tpl`:
````
{{ facebook_meta_block admins="123422,234223432,234234234,23423423" }}{{ /facebook_meta_block }}
````
The Smarty plugin will generate HTML code, for example:

//ex. , (*2)


You can read more about Open Graph tags in the [Facebook developer docs](https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content/). **Submitted and scheduled for publication articles on Facebook** This plugin provides a special treatment for articles which have not yet been published. The URI has this format: ```/f/+{webcode}``` For example: ```/f/+j6gd4``` and can be found in the plugin's sidebar widget in the article editor. ![Screen](http://i58.tinypic.com/2rzyp2t.png) By default only simple HTML structure with Open Graph meta tags will be rendered for the Facebook crawler. You can override this with the ```__fb_submited_article.tpl``` template file included in your template. Example template output:

, (*3)

test article

```, (*4)

Plugin in action:

When you enter the article edit screen in Newscoop, the plugin will check if there is already information about that article in the database. If not, it will connect to Facebook Graph API and download all necessary information. Next, that information will be inserted into the Newscoop database., (*5)

If connection to Facebook is a success, the status message on Screen 1 will show up., (*6)

Screen 1, (*7)

Screen 1: General Plugin view., (*8)

To clear the article cache, just click the Clear article cache on Facebook button and a message will show up (look at Screen 2)., (*9)

Screen 2, (*10)

Screen 2: Connecting message after button click., (*11)

If for some reason connection to Facebook isn't possible, we will see an error message (look at Screen 3), (*12)

Screen 3, (*13)

Screen 3: Connection to Facebook failed - status message., (*14)

License

This plugin is released under the GNU General Public License v3. You can read the complete license in the source., (*15)

About

The Facebook plugin for Newscoop is a Sourcefabric z.ú. initiative., (*16)

The Versions

25/08 2016

dev-master

9999999-dev

Usefull sevices for integration Newscoop and Facebook

  Sources   Download

GPL-3.0

The Requires

 

by Avatar nalyk

cms facebook newscoop integration