Extension talk:Social Sidebar

Jump to navigation Jump to search

About this board

213.136.59.66 (talkcontribs)

Is there any way to have it centered on the Sidebar?

Thanks in advance! /Joakim

Reply to "Centered"

Is it possible to insert the button on every page header?

1
Tango granada (talkcontribs)
Reply to "Is it possible to insert the button on every page header?"

Is it possible to change the position of the Social Bar?

2
189.38.207.184 (talkcontribs)

I would like to put it above the "Tools". Is it possible?

Reply to "Is it possible to change the position of the Social Bar?"

I tweaked the extension to support linkedin and +1

1
Robpol86 (talkcontribs)

This extension was exactly what I was looking for, however I tweaked it a little to fit my needs. Perhaps you can merge my changes into your code for others to use? Everything is hard coded since it's only for me so it needs to be cleaned up a little bit.

<?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]].
 */

$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::SocialLinks';

// Class & functions
class SocialSidebar {
        function SocialLinks( $skin, &$bar ) {
                $bar['Social']  = "\n";
    
                // Facebook
                $bar['Social']  .= '<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];\
if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";\
fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));</script><div class="fb-like" data-send="false" \
data-layout="button_count" data-width="140" data-show-faces="false"></div>'."\n\n";

                // Twitter
                $bar['Social'] .= '<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a><script>!function(d,s,id)\
{var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";\
fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>'."\n\n";

                // Linked In
                $bar['Social'] .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>\
<script type="IN/Share" data-counter="right"></script>'."\n\n";

                // +1
                $bar['Social'] .= '<g:plusone size="medium" annotation="inline" width="140"></g:plusone>\
<script type="text/javascript">(function() {var po = document.createElement("script"); po.type = "text/javascript"; \
po.async = true;po.src = "https://apis.google.com/js/plusone.js";var s = document.getElementsByTagName("script")[0]; \
s.parentNode.insertBefore(po, s);})();</script>'."\n\n";

                return true;
        }
}
Reply to "I tweaked the extension to support linkedin and +1"
Dave88008 (talkcontribs)

I get this after install: Parse error: syntax error, unexpected T_VARIABLE in /home/content/65/6092565/html/scientolipedia/LocalSettings.php on line 204

Is that enough to give you an idea what I need to fix? Thanks MediaWiki 1.18.0 (Semantic Bundle Version 2011-08-24.20111208-dev) PHP 5.2.17 (cgi-fcgi) MySQL 5.0.91-log

Kghbln (talkcontribs)

You should provide line 204 of your LocalSettings.php too. I suspect a problem with the invocation of the Semantic Bundle. Cheers

Reply to "Parse error"
Akerbeltz (talkcontribs)

Nice extension, first of all, many thanks! Question though, is there something I can set to change the width of the Follow button or to insert a linebreak? MountWiki is just about short enough to display but my Twitter name is akerbeltzalba, which makes the last -a creep into my text body area. Any hints would be greatly appreaciated! Akerbeltz 19:27, 20 November 2011 (UTC)

Reply to "Width issue"
72.211.252.69 (talkcontribs)

ERROR!

Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method SocialSideBar::FBTwitter() should not be called statically in C:\xampp\htdocs\includes\Hooks.php on line 158

Localsettings code:

 $wgFBImage = "/extensions/SocialSideBar/facebook.png";
 $wgFBLink  = "http://www.facebook.com/pages/Cole-Stuff/162794417087497";
 $wgTwitterImage = "/extensions/SocialSideBar/twitter.png";
 $wgTwitterLink  = "http://www.twitter.com/colejohnson66";
Joa ds (talkcontribs)

Which MediaWiki version are you using?

72.211.252.69 (talkcontribs)

1.17

72.211.252.69 (talkcontribs)

Updated to 0.2, now this:

Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method SocialSideBar::FBTwitter() should not be called statically in C:\xampp\htdocs\includes\Hooks.php on line 158

Localsettings.php

require_once("$IP/extensions/SocialSideBar/SocialSideBar.php");
$wgFB  = "http://www.facebook.com/pages/Cole-Stuff/162794417087497";
$wgTwitter  = "colejohnson66";
Joa ds (talkcontribs)

That is really strange.

I am testing all my extensions on 15.5 and have no problems, so not really sure what is causing it.

Could you try to add 'static' to the FBTwitter function (in SocialSideBar.php): So it should look like

// Class & functions
class SocialSideBar {
	static function FBTwitter( $skin, &$bar ) {
....

And let me know if this fixes it

Reply to "ERROR!"
There are no older topics