Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How about a social sharing plugin?

+21 votes
3,076 views
asked Aug 8, 2011 in Plugins by NoahY
recategorized Nov 13, 2011 by gidgreen

Another thing I thought useful is buttons for sharing content on social networks:

I think the benefit of having these buttons on each question page need not be elaborated on.

So, I made a plugin, and here it is:

https://github.com/NoahY/q2a-share

There is an admin block to toggle which of the (currently four, above) buttons to show, and in which order, as well as an optional "suggestion" text to show when there are no answers:

I'd consider this "beta" code.  It probably won't break your site, but it may still be buggy.

The buttons currently come after the question's response buttons, inside the same div.  That's the best I could do, if you think you can do better, you can always edit the qa-share-layer.php and change the function based on Q2A's layer module API:

http://www.question2answer.org/layers.php

EDIT: added email, new admin screen

commented Nov 12, 2011 by Raj
This is a must have plugin.

I think "#xfbml=1" on qa-share-layer.php creating conflict with Facebook Login plugin. After removing #xfbml=1 Facebook Login now working.
commented Nov 12, 2011 by NoahY
Okay, I've removed that... I can't verify what you say, because I don't use facebook login.  Hopefully it is correct.
commented Nov 21, 2012 by chayote
I installed for ver 1.5.3, however nothing happen affter selecting and saving. Please help me. Thanks in advance
commented Nov 18, 2013 by Filippo Jager Cordio
Hi NoahY, I installed your plugin on my website here http://unconfessable.com/home/?qa=questions but it doesn't work ...Facbook and G+ buttons don't share. Twitter button only works correctly ...do you have any suggestion? Thank you

10 Answers

+2 votes
answered Aug 8, 2011 by WhyCheese
Thanks for another great plugin NoahY ! :)
0 votes
answered Aug 8, 2011 by Aslan
Nice plugin! Does it also show the number of people who liked/twittered?
commented Aug 9, 2011 by NoahY
It could be easily tweaked to, but it would take up a lot of space that way...
commented Aug 10, 2011 by Aslan
Define "a lot of space" please ... ;-)
commented Aug 10, 2011 by NoahY
About three times as tall as the current layout, I think.
commented Sep 21, 2011 by Scott
You can have the numbers appear to the right of the buttons. AddThis.com has that as one of the options (if you haven't seen AddThis, take a look, it's pretty good).
commented Feb 2, 2013 by AliBhai
We can have no's appear above the buttons
0 votes
answered Aug 10, 2011 by maordany

First of all it's really beautiful and thank you

My question is this. If this plugin shows on all the questions Is it possible to add the code of Google advertising to Any question with this plugin?

If so, where should I add the code?

commented Aug 11, 2011 by NoahY
You could do better than to use this plugin.  Better to make a new theme, edit qa-theme.php and add code like:

        function q_view($q_view)

        {

            qa_html_theme_base::q_view($q_view);

           

            $this->output_raw('insert your html here');



        }
0 votes
answered Sep 20, 2011 by Tom Cho
Great plugin. Thanks!
+1 vote
answered Sep 21, 2011 by Aslan
It's one heck of a great plugin, many thanks to NoahY.

A tiny tip: it would be nice if there was the possibility to show the notification text always... wether there are answers or not.. so it would act like a title or so.
0 votes
answered Oct 19, 2011 by Lucian
Hi NoahY. First of all, Thank you for your plugins, you are doing a good job. Secondly,   i have a problem with Facebook logout button(i can't logout if i am loged in using FB account)  if like button from share plugin is active. I've got the same issue when i tried to embed facebook like button.
commented Nov 17, 2011 by Raj
just download the new version of share plugin from https://github.com/NoahY or remove #xfbml=1 from qa-share-layer.php

I have the same problem. Now it solved.
commented May 29, 2012 by bishu
Thanks for this nice plugin. Is there any way to share with facebook by giving some custom description which is not included int he question.
0 votes
answered Jun 1, 2012 by Question Nut
Thanks NoahY for the plugin.. would it be possible to make the button a facebook sahre button rather than a like button?

Or ensure the little pop up window appears so text can be added to the share?
commented Jun 6, 2012 by q2apro
just go to the plugin folder qa-plugin/q2a-share-buttons/ and open the file: qa-share-layer.php

on line 76: 'facebook'=> '<iframe src="http://www.facebook.com/plugins/like.php?href='....
change this code as needed.

btw: "What happened to the old Share button? We deprecated the Share Button when we launched the Like button" http://developers.facebook.com/docs/reference/plugins/like/
0 votes
answered Jun 7, 2012 by bishu
Grate Plugin @NoahY . Thanks for your contribution.

I have a little problem - I was trying to share my question on my Facebook Page wall but I am unable to do that.

Ex. I have a Facebook User ID and I have created 3 Pages. Now I want to share my question on my Page Wall. How can I do that. I did not get any option for that and it directly share the question on my user ID wall.

Thanks in Advance.
commented Jun 8, 2012 by bishu
Anyone please guide me to share the question on my facebook Page wall instead of my Wall.
+3 votes
answered Feb 20, 2013 by IamRobin

Hey Noahy  There is Tutorial For Making New Stackoverflow Style Shareing plugin please take a look and made this 

http://www.queness.com/post/309/create-a-digg-style-post-sharing-tool-with-jquery

 

0 votes
answered Nov 11, 2013 by Pady Srini

Downloaded this plugin. Using 1.5.3 Q2A. Facebook alone reports "Error".

This is the iframe code generated -
 
<iframe src="//www.facebook.com/plugins/like.php?href=www.clay6.com/qa/15734/overrightarrow-overrightarrow-overrightarrow-overrightarrow&send=false&layout=standard&width=53&layout=button_count&show_faces=false&action=like&colorscheme=light&font&height=20&appId=170382616390886" scrolling="no" frameborder="0" style="border: none; overflow: hidden; width: 53px; height: 20px;" allowtransparency="true"/>
 
Any help appreciated.
 
Thanks
 
pady
...