Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
4 posts Page 1 of 1
Hello!

I needed to show information from some social networks in a client site. So I decided to create this addon for CouchCMS. It displays information from Facebook, Twitter, Google+ and Instagram.
social.zip
(13.08 KiB) Downloaded 719 times

Installation:
1. Extracting the attached zip will yield a folder named 'social'.
Place it within your Couch installation's 'addons' folder.
2. Add the follwing line of code to 'addons/kfunctions.php' file
(v1.4 will have a file named 'kfunctions.example.php' in the addons folder. Please rename it to 'kfunctions.php)
Code: Select all
require_once( K_COUCH_DIR.'addons/social/social.php' );


Configuration:
You need to enter the keys and information from social networks in 'social/config.php' file
Code: Select all
   //Facebook
   $facebook = '';

   //Twitter
   $twitter = '';
   $consumerkey         = "";
   $consumersecret      = "";
   $accesstoken         = "";
   $accesstokensecret   = "";

   //Google+
   $googleplus_id = '';
   $googleplus_key = '';
   
   //Instagram
   $instagram_id = '';
   $instagram_accesstoken = '';


Usage:
This addon creates a new tag on the Couch, named "social_stats".
To use it, place it within a Couch template like this
Code: Select all
<cms:social_stats handle=''>
   <!-- info -->         
</cms:social_stats>

This addon only supports the parameter handle, it is used to specify which social network you want to display information.

Variables:
There are different variables for each social network. Following is the list.

Facebook - id, about, category, checkins, cover_id, cover_image, name, username, website, likes, link.

Twitter - id, name, screen_name, description, link, friends, followers, favourites, statuses, profile_image_url.

Google+ - followers, circledByCount, about, cover_image, link.

Instagram - username, bio, profile_picture, id, link, followers, media, follows.

A example:
The code displays the amount of likes or followers and link profile in social network

Code: Select all
<cms:social_stats handle='facebook'>
    <div>
        <a href="<cms:show link />"><img alt="facebook" src="img/fb.png" />
            <span><cms:show likes /></span>
        </a>
    </div>
</cms:social_stats>

<cms:social_stats handle='twitter'>
    <div>
        <a href="<cms:show link />"><img alt="twitter" src="img/tw.png" />
            <span><cms:show followers /></span>
        </a>
    </div>
</cms:social_stats>

<cms:social_stats handle='google+'>
    <div>
        <a href="<cms:show link />"><img alt="google+" src="img/gplus.png" />
            <span><cms:show followers /></span>
        </a>
    </div>
</cms:social_stats>

<cms:social_stats handle='instagram'>
    <div>
        <a href="<cms:show link />"><img alt="instagram" src="img/ig.png" />
            <span><cms:show followers /></span>
        </a>
    </div>
</cms:social_stats>


Hope this helps.
Hi Rafael,

thanks for the great Addon. I have a little issue with the Twitter implementation.

When I try to display, I get the following errors:


Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/plen227116/domains/soft-canvas.com/public_html/expo/admin/addons/social/twitteroauth/twitteroauth.php on line 10

Warning: require_once(http://oauth.googlecode.com/svn/code/php/OAuth.php): failed to open stream: no suitable wrapper could be found in /home/plen227116/domains/soft-canvas.com/public_html/expo/admin/addons/social/twitteroauth/twitteroauth.php on line 10

Fatal error: require_once(): Failed opening required 'http://oauth.googlecode.com/svn/code/php/OAuth.php' (include_path='.:/usr/local/lib/php') in /home/plen227116/domains/soft-canvas.com/public_html/expo/admin/addons/social/twitteroauth/twitteroauth.php on line 10

Any idea's? The rest works just fine and I would really like to implement twitter as well :)
Change line 10 of twitteroauth.php from:
Code: Select all
require_once('http://oauth.googlecode.com/svn/code/php/OAuth.php');
to:
Code: Select all
require_once('OAuth.php');
Including a remote file is almost always a bad idea anyways, so this change is definitely advisable.
Hi Cheesypoof, thanks for your reply.

The errors are gone now, but none of the variables output anything :(
4 posts Page 1 of 1