All Projects → nystudio107 → buffer

nystudio107 / buffer

Licence: MIT license
DEPRECATED Send social updates to Twitter, Facebook, etc. through Buffer.com via Twig templates, URLs, and plugins.

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to buffer

Craft Fieldlabels
Override Craft CMS field labels and instructions in the field layout designer
Stars: ✭ 128 (+197.67%)
Mutual labels:  craftcms, craft-plugin
Spoon
Spoon plugin for Craft CMS - Enhance your Matrix fields with groups, tabs and more!
Stars: ✭ 82 (+90.7%)
Mutual labels:  craftcms, craft-plugin
Craft Seomatic
SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
Stars: ✭ 135 (+213.95%)
Mutual labels:  craftcms, craft-plugin
Craft Asset Rev
A Craft CMS plugin to help with cache busting
Stars: ✭ 109 (+153.49%)
Mutual labels:  craftcms, craft-plugin
Seo
SEO utilities including a unique field type, sitemap & redirect manager
Stars: ✭ 210 (+388.37%)
Mutual labels:  craftcms, craft-plugin
Plugins
The master list of Craft 3-compatible plugins
Stars: ✭ 111 (+158.14%)
Mutual labels:  craftcms, craft-plugin
Commerce
Fully integrated ecommerce for Craft CMS
Stars: ✭ 144 (+234.88%)
Mutual labels:  craftcms, craft-plugin
Guest Entries
Accept anonymous entry submissions with Craft.
Stars: ✭ 100 (+132.56%)
Mutual labels:  craftcms, craft-plugin
Retour
DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Stars: ✭ 172 (+300%)
Mutual labels:  craftcms, craft-plugin
Craft Embedded Assets
Manage YouTube videos, Instagram photos, Twitter posts and more as first class assets in Craft CMS
Stars: ✭ 165 (+283.72%)
Mutual labels:  craftcms, craft-plugin
Craft Quick Field
Create fields on the fly while designing field layouts
Stars: ✭ 104 (+141.86%)
Mutual labels:  craftcms, craft-plugin
craft3-sitecopy
With this plugin you can copy the content of an entry to another site.
Stars: ✭ 22 (-48.84%)
Mutual labels:  craftcms, craft-plugin
Craft Preparse Field
Field type that parses twig when an element is saved.
Stars: ✭ 103 (+139.53%)
Mutual labels:  craftcms, craft-plugin
Minify
DEPRECATED A simple plugin that allows you to minify blocks of HTML, CSS, and JS inline in Craft CMS templates
Stars: ✭ 111 (+158.14%)
Mutual labels:  craftcms, craft-plugin
Instantanalytics
DEPRECATED Instant Analytics brings full Google Analytics support to your Twig templates and automatic Craft Commerce integration with Google Enhanced Ecommerce.
Stars: ✭ 103 (+139.53%)
Mutual labels:  craftcms, craft-plugin
Simplemap
A beautifully simple map field type for Craft CMS.
Stars: ✭ 136 (+216.28%)
Mutual labels:  craftcms, craft-plugin
Craft.patrol
Patrol simplifies SSL and maintenance routing for sites built with Craft
Stars: ✭ 91 (+111.63%)
Mutual labels:  craftcms, craft-plugin
Buttonbox
A collection of utility field types for Craft
Stars: ✭ 94 (+118.6%)
Mutual labels:  craftcms, craft-plugin
Linkit
Multi-purpose link plugin for Craft CMS
Stars: ✭ 155 (+260.47%)
Mutual labels:  craftcms, craft-plugin
Craft Imageoptimize
Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.
Stars: ✭ 227 (+427.91%)
Mutual labels:  craftcms, craft-plugin

No Maintenance Intended

DEPRECATED

This Craft 2.x plugin is no longer supported, but it is fully functional, and you may continue to use it as you see fit. The license also allows you to fork it and make changes as needed for legacy support reasons.

Buffer plugin for Craft CMS

A plugin for integrating Buffer into Craft CMS websites, allowing you to send social updates to Twitter, Facebook, etc. through Buffer.com via Twig templates, URLs, and plugins.

Installation

  1. Download & unzip the file and place the buffer directory into your craft/plugins directory
  2. -OR- do a git clone https://github.com/nystudio107/buffer.git directly into your craft/plugins folder. You can then update it with git pull
  3. Install plugin in the Craft Control Panel under Settings > Plugins
  4. The plugin folder should be named buffer for Craft to see it. GitHub recently started appending -master (the branch name) to the name of the folder for zip file downloads.

Configuring Buffer###

First, make sure you have set up a Buffer account and see the Buffer API for details on how to set up your Buffer app for API access.

Next in the Craft Admin CP, go to Settings->Plugins->Buffer and enter your Buffer Access Token, Buffer Client ID, Buffer Client Secret, and Buffer Redirect URI.

Fill in the Profile IDs for your social media accounts. You can find out each profile’s id from your dashboard, click on each social profile tab and notice the URL in browser, it will be something like this:

https://bufferapp.com/app/profile/SOCIALPROFILEID/buffer

The string between “/profile/” & “/buffer/” is the social profile id. If you don't have a Profile ID for a given service, just leave it blank.

Currently Pinterest is unsupported, as the Buffer team has not provided the appropriate API access, but they say they will soon.

Using the Buffer plugin in your templates

sendBufferUpdate

sendBufferUpdate sends the social update to Buffer immediately. In most cases, it's better to use queueBufferUpdate instead, since that spins off a Craft Task that handles the update sending in the background (it can sometimes be lengthy).

Both of these methods accomplish the same thing:

{# Send an update to Buffer using the 'sendBufferUpdate' function #}
{{ sendBufferUpdate(UPDATE_TEXT, UPDATE_NOW, UPDATE_LINK, UPDATE_PICTURE, UPDATE_THUMBNAIL) }}

{# Send an update to Buffer using the 'sendBufferUpdate' filter #}
{{ UPDATE_TEXT | sendBufferUpdate(UPDATE_NOW, UPDATE_LINK, UPDATE_PICTURE, UPDATE_THUMBNAIL) }}

All of the parameters except for UPDATE_TEXT are optional. For more information on what these parameters are, please see POST/updates/create

queueBufferUpdate

queueBufferUpdate works much like sendBufferUpdate, except that it spins off the social update to Buffer into a Craft Task. Since the update process can be lengthy, this the preferred way to send updates to Buffer.

Both of these methods accomplish the same thing:

{# Send an update to Buffer using the 'queueBufferUpdate' function #}
{{ queueBufferUpdate(UPDATE_TEXT, UPDATE_NOW, UPDATE_LINK, UPDATE_PICTURE, UPDATE_THUMBNAIL) }}

{# Send an update to Buffer using the 'sendBufferUpdate' filter #}
{{ UPDATE_TEXT | queueBufferUpdate(UPDATE_NOW, UPDATE_LINK, UPDATE_PICTURE, UPDATE_THUMBNAIL) }}

All of the parameters except for UPDATE_TEXT are optional. For more information on what these parameters are, please see POST/updates/create

Triggering the Buffer via URL

You can also trigger buffer updates via URL to the Buffer controller:

http://YOURSITE.com/buffer/buffer/update?text=UPDATE_TEXT&now=UPDATE_NOW&link=UPDATE_LINK&picture=UPDATE_PICTURE&thumbnail=UPDATE_THUMBNAIL

All of the parameters except for UPDATE_TEXT are optional. For more information on what these parameters are, please see POST/updates/create

Using the Buffer service in your plugins

You can send updates to Buffer via your plugins as well.

craft()->buffer_utils->sendBufferUpdate()

craft()->buffer_utils->sendBufferUpdate() sends the social update to Buffer immediately. In most cases, it's better to use craft()->buffer_utils->queueBufferUpdate() instead, since that spins off a Craft Task that handles the update sending in the background (it can sometimes be lengthy).

/* -- Send an update to Buffer using the 'sendBufferUpdate' service */
craft()->buffer_utils->sendBufferUpdate(UPDATE_TEXT, UPDATE_NOW, UPDATE_LINK, UPDATE_PICTURE, UPDATE_THUMBNAIL )

All of the parameters except for UPDATE_TEXT are optional. For more information on what these parameters are, please see POST/updates/create

craft()->buffer_utils->queueBufferUpdate()

craft()->buffer_utils->queueBufferUpdate() works much like craft()->buffer_utils->sendBufferUpdate(), except that it spins off the social update to Buffer into a Craft Task. Since the update process can be lengthy, this the preferred way to send updates to Buffer.

Both of these methods accomplish the same thing:

/* -- Send an update to Buffer using the 'queueBufferUpdate' service */
craft()->buffer_utils->queueBufferUpdate(UPDATE_TEXT, UPDATE_NOW, UPDATE_LINK, UPDATE_PICTURE, UPDATE_THUMBNAIL )

All of the parameters except for UPDATE_TEXT are optional. For more information on what these parameters are, please see POST/updates/create

Example Plugin

Here's an example plugin that you can modify to post updates when someone posts to the "blog" channel:

<?php
namespace Craft;

class ImawhalePlugin extends BasePlugin
{
    function getName()
    {
        return Craft::t('Imawhale');
    }

    function getVersion()
    {
        return '1.0.0';
    }

    function getDeveloper()
    {
        return 'nystudio107';
    }

    function getDeveloperUrl()
    {
        return 'http://nystudio107.com';
    }

    public function hasCpSection()
    {
        return false;
    }

	public function init()
	{
	    parent::init();
	
	    craft()->on('entries.onBeforeSaveEntry', function(Event $event) 
	    {
	        $entry = $event->params['entry'];
	        if ($entry->section == 'Blog Entry') 
	        {
				$siteUrl = craft()->siteUrl;
				$hashTag = " #imawhale";
			    $user = craft()->users->getUserById($entry->authorId);
			    $userName = "";
				if ($user)
				{
			        $userName = $user->getFullName();
				}
				
				if ($userName)
					$userName = " " . $userName;
					
	            if ($event->params['isNewEntry']) 
	            {
					$updateString = "New Imawhale blog post “" . $entry->title . "” by" . $userName . " " . $siteUrl . "/blog/" . $entry->slug . $hashTag;
					
					ImawhalePlugin::log('A new blog entry has been posted: ' . $entry->title, LogLevel::Info, true);
	
					craft()->buffer_utils->queueBufferUpdate($updateString, true);
	            } 
	            else 
	            {

	            }
	        }
	    }); // edited
	}
	
}

Changelog

1.0.3 -- 2016.02.03

  • Fixed an issue where the [media] array wasn't being passed down properly, which prevented you from sending images in your social media updates
  • Updated README.md

1.0.2 -- 2015.11.23

  • Added support for Craft 2.5 new plugin features

1.0.1 -- 2015.11.08

  • Updated the README with an example plugin

1.0.0 -- 2015.09.27

  • Initial release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].