Extension:Social Sidebar

Category:Extensions which host their code in-wiki Category:Unmaintained extensions#Social%20Sidebar Category:Extensions without a compatibility policyCategory:Extensions with unknown license
MediaWiki extensions manual
Social Sidebar
Release status: unmaintainedCategory:Unmaintained extensions
Implementation Skin Category:Skin extensions
Description Adds Links to Twitter and Facebook in the sidebar
Author(s) Joachim De Schrijver (joa_dstalk)
Latest version 0.2 (2011-09-12)
MediaWiki 1.15+Category:Extensions with manual MediaWiki version
Database changes No
License LGPL
Download see here
Example MountWiki.com
$wgFBLink,
$wgTwitterLink
Category:All extensionsCategory:Extensions not in ExtensionJson

The Social Sidebar extension adds links to a Twitter and Facebook account in the sidebar.

Installation

  • Copy the code into a file and place the file(s) in a directory called SocialSidebar in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    require_once "$IP/extensions/SocialSidebar/SocialSidebar.php";
    // Specifiy the Twitter and Facebook pages:
    $wgFacebook = "The complete link to your Facebook page";
    // e.g. $wgFacebook = "https://www.facebook.com/pages/Mount-Wiki/94013348117";
    $wgTwitter = "The name of your Twitter account";
    // e.g. $wgTwitter = "MountWiki";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.Category:Extensions not using extension registration

Note Note:

  • The description (label) of the portlet should be set in [[MediaWiki:Socialsidebar]].
  • When used in combination with another plugin that adds boxes to the sidebar, the order of calling the extension in the LocalSettings.php will determine the order of the extension boxes in the sidebar.
  • Because of inconsistencies in the skin implementation, this extension will work with the following skins: cologneblue, standard, nostalgia

Update History

12 September 2011: v 0.2

  • Using Twitter's Follow button instead of own image
  • Using Facebook's Like button instead of own image

24 July 2011: v 0.1

  • First public version

Code

SocialSidebar.php
<?php
/**
 * MediaWiki extension to add a social sidebar in a portlet in the sidebar.
 * Installation instructions can be found on
 * https://www.mediawiki.org/wiki/Extension:Social_Sidebar
 *
 * This extension will not add the Social Sidebar portlet to *any* skin
 * that is used with MediaWiki. Because of inconsistencies in the skin
 * implementation, it will not be add to the following skins:
 * cologneblue, standard, nostalgia
 *
 * @addtogroup Extensions
 * @author Joachim De Schrijver
 * @license LGPL
 *
 * Social Sidebar
 */

/**
 * Exit if called outside of MediaWiki
 */
if( !defined( 'MEDIAWIKI' ) ) {
	echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
	die( 1 );
}

/**
 * SETTINGS
 * --------
 * The description of the portlet can be changed in [[MediaWiki:Socialsidebar]].
 *.
 * Variables should be set in the LocalSettings.php
 */
$wgTwitter  = "";
$wgFacebook = "";

$wgExtensionCredits['other'][] = array(
	'name'           => 'Social Sidebar',
	'version'        => '0.2',
	'author'         => '[https://www.mediawiki.org/wiki/User:Joa_ds Joachim De Schrijver]',
	'description'    => 'Adds [http://www.twitter.com Twitter] and [http://www.facebook.com Facebook] links to the sidebar',
	'url'            => 'https://www.mediawiki.org/wiki/Extension:Social_Sidebar',
);

// Hook to modify the sidebar
$wgHooks['SkinBuildSidebar'][] = 'SocialSidebar::FacebookTwitter';

// Class & Functions
class SocialSidebar {
	static function FacebookTwitter( $skin, &$bar ) {
		global $wgFacebook,$wgTwitter;
		
		if ($wgFacebook != "")
			$bar['socialsidebar']  = '<iframe src="http://www.facebook.com/plugins/like.php?app_id=150743178336313&amp;href='.rawurlencode($wgFacebook).'&amp;send=false&amp;layout=button_count&amp;width=135&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:135px; height:21px;" allowTransparency="true"></iframe>';
		if ($wgTwitter != "")
			$bar['socialsidebar'] .= '<a href="http://twitter.com/'.$wgTwitter.'" class="twitter-follow-button" data-show-count="false">Follow @'.$wgTwitter.'</a><script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>';
		return true;
	}
}
Category:Twitter extensions Category:Facebook extensions Category:Menu extensions
Category:All extensions Category:Extensions not in ExtensionJson Category:Extensions not using extension registration Category:Extensions which host their code in-wiki Category:Extensions with manual MediaWiki version Category:Extensions with unknown license Category:Extensions without a compatibility policy Category:Facebook extensions Category:Menu extensions Category:SkinBuildSidebar extensions Category:Skin extensions Category:Twitter extensions Category:Unmaintained extensions