firesphere/social

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (dev-master) of this package.

Simple Silverstripe CMS wrapper to post to Twitter and Facebook Page Wall as Page

Installs: 44

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 4

Forks: 4

Open Issues: 4

Type:silverstripe-module

dev-master 2013-08-19 16:15 UTC

This package is auto-updated.

Last update: 2020-12-21 02:25:23 UTC


README

=======================

Introduction

This is a simple social-media-sharer. It will use the API of the selected (currently, only Twitter yet) social media to post something. Follow the instructions in your settings to get things working

Maintainer Contacts

  • Simon "Sphere" Erkelens github[at]casa-laguna[dot]net

Features

<?php
	public function onAfterWrite(){
		parent::onAfterWrite();
		$siteConfig = SiteConfig::current_site_config();
		/**
		 * This is related to another module of mine.
		 * Check it at my repos: Silverstripe-Social.
		 * It auto-tweets your new Newsitem. If the TwitterController exists ofcourse.
		 * You can do a lot of different configs here, but I strongly suggest to include the "Tweeted" boolean in your $db declaration.
		 * Otherwise, you might tweet everytime you change something, which can get quite annoying ;)
		 */
		if($this->Live && !$this->Tweeted && $siteConfig->TweetOnPost){
			if(class_exists('TwitterController')){
				TwitterController::postTweet($this->Title, $this->AbsoluteLink());
				$this->Tweeted = true;
				$this->write();
			}
		}
	}

For Facebook, I used this test-function in page.php and called it via mydomain.com/home/testFacebook

<?php
	public function testFacebook(){
		FacebookController::postFacebook('New Message, hooray!');
	}

Please help me test!

Lacks

  • Support for all users instead of just one account
  • And a lot more

Requirements

User posting needs to be logged in to Facebook at the moment the module tries to post.

Installation

If you don't have a github account, just download:

  1. Click on the big "ZIP" button at the top.
  2. Extract the zip to your site-root
  3. Run in your browser - www.example.com/dev/build to rebuild the database.

Other option is to clone the repo into your site-root:

  1. In your site-root, do git clone https://github.com/Firesphere/silverstripe-social.git.
  2. Run in your browser - www.example.com/dev/build to rebuild the database.

Although, I would like it if you forked and cloned, because if you do, you can help me by adding features and make pull-requests to improve this module!

  1. Make a fork of this module.
  2. In your site-root, do git clone https://{your username}@github.com/{your username}/silverstripe-social.git.
  3. Run in your browser - www.example.com/dev/build to rebuild the database.

Note, forking is NOT REQUIRED, only handy if you want to help out.

After installation, setup your app with the desired social network. For twitter, go here: https://dev.twitter.com Setting up your application, will give you a consumer key/secret combination. Set this in your siteconfig and you're good to go.

For Facebook, it requires a few extra steps, sadly. Here goes:

  • Create a new app at https://developers.facebook.com
  • Under "Select how your app integrates with Facebook" Select Website with Facebook Login and set the URL tp http://yoursi.te/FacebookController/callback/
  • Copy the AppID, Secret and API-key to the corresponding fields in the CMS
  • Make sure you are admin of the corresponding page you want to publish to.
  • Get the page-ID. This one is tricky, google it, because I don't have much space.
  • Sign in and see what happens.

I have explicitly NOT included my own keys in this module, because it's not necessary, create your own is better for you ;) Any questions would preferably be asked via the issues-github-method.

Please, please, please, do not forget to include a boolean in your page/model which checks if the specific model/page has already been posted to facebook. If you forget, you'll end up in an infinite loop and a LOT of deleting useless links from facebook! Working example can be found in my newsmodule git repo.

Configuration

  • In the SiteConfig, set your wished configuration in the tabs you want to use.

Best practices

If you have Facebook connected to twitter, don't post to facebook and twitter as well! Twitter will reject your message because it's a duplicate!

Notes

  • Your "login with twitter" button looks fugly!

Yes, I know. I'm sorry.

Plans

  • Integrate Facebook OAuth.
  • Integrate Pinterest.
  • Integrate Google+ (Not gonna happen soon. G+ API is a closed API at the moment)
  • Multi-user support.

Requests

  • Improvements.
  • Translations.

Other

  • This module is given "as is" and I am not responsible for any damage it might do to your brain, dog, cat, house, computer or website.
  • Code Comments should not be taken too seriously, since I'm bad at writing serious code-comments.
  • Please use the Issue-tracker, otherwise I get lost too.

Actual license

This module is published under BSD 2-clause license, although these are not in the actual classes, the license does apply:

http://www.opensource.org/licenses/BSD-2-Clause

Copyright (c) 2013, Simon "Sphere" Erkelens

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(I shouldn't scream, should I? This is copy-paste from BSD-2 license...)