MyBB Community Forums

Full Version: Enhanced Social Share buttons Tutorial without plugins
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Thanks much for this .. am tring it out. Two issues :

a) Facebook Like shows up but Facebook Share doesn't.

b) Anyway to add LinkedIn share also .. that will be very good !

I am new to PHP.. all help appreciated !

Great effort and thanks !


(2013-01-18, 02:40 AM)envira Wrote: [ -> ]Hello guys,
Its been a long time since i have posted any tut,
Here is one for you.

Original Topic written for www.myskins.org

As said in the title, i present you enhanced social share buttons in Show Thread/post/topic without a plugin.

So lets start with :

1. Editing the Global.css :
Go to your theme > global.css > advanced mode
Add the following code at bottom of your global.css

.socialshare {
padding: 5px;
border-radius: 2px;
margin-top: -11px;
}

.sst {
background: #51CDF6;
border: 1px solid #4DB9D5;
padding: 5px;
text-align: center;
vertical-align: top;
-webkit-border-radius: 2px;
-khtml-border-radius: 2px;
border-radius: 2px;
float: left;
margin-right: 5px;
}

.ssg {
background: #D4503F;
border: 1px solid #CE0E0E;
padding: 5px;
text-align: center;
vertical-align: top;
-webkit-border-radius: 2px;
-khtml-border-radius: 2px;
border-radius: 2px;
float: left;
margin-right: 5px;
}

.ssf {
background: #4A65A1;
border: 1px solid #1D59A5;
padding: 5px;
text-align: center;
vertical-align: top;
-webkit-border-radius: 2px;
-khtml-border-radius: 2px;
border-radius: 2px;
float: left;
margin-right: 5px;
}		

2. Editing the Templates :
Go to your theme templates > Showthread templates > showthread template.

Find :
<body>
{$header}
{$pollbox}


Add this code just after that

<div style="float: left" class="socialshare">
<span class="sst"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-lang="en" >Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></span>
<span class="ssg"><script type="text/javascript" src="https://apis.google.com/js/plusone.js">
  {lang: 'en'}
</script>
<g:plusone size="medium" href="{$mybb->settings['bburl']}/showthread.php?tid={$tid}"></g:plusone></span>
<span class="ssf"><iframe src="//www.facebook.com/plugins/like.php?href={$mybb->settings['bburl']}/showthread.php?tid={$tid}&amp;send=false&amp;layout=button_count&amp;width=130&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:130px; height:20px;" allowTransparency="true"></iframe></span>
<span class="ssf"><a title="Share On Facebook" href="http://www.facebook.com/share.php?u={$mybb->settings['bburl']}/showthread.php?tid={$thread['tid']}" target="_blank" style="color: #FFF;"><img src="images/fb.png" alt="Facebook" style="padding-right: 5px;padding-bottom: 2px;vertical-align: middle;"/> <b>Share</b></a></span>
</div>
<br />

here is a preview of what you do : link

Live Demo : Click

Hope you guys like it Smile
P.S: Please give credits to me, if you post it on any other site.
Regards,
envira, thank you nice tutorial. Now I need to figure out where I want to implement on my theme. Anyone that wishes to inspect. Click to visit Information Station credits will be given soon.
(2013-10-09, 03:34 PM)Blastermaster Wrote: [ -> ]envira, thank you nice tutorial. Now I need to figure out where I want to implement on my theme. Anyone that wishes to inspect. Click to visit Information Station credits will be given soon.

Ha ha thanks man , Smile glad you liked it , will update the tut with more steamlined sharebuttons , probably with jQuery soon,
regards
Thanks. but Facebook share image is not work. i also remove it. thanks for tute.

http://lkxforum.comli.com/index.php
(2016-10-23, 04:13 AM)Elite_x Wrote: [ -> ]Thanks. but Facebook share image is not work. i also remove it. thanks for tute.

http://lkxforum.comli.com/index.php

Use the code below for share image to work.

<div style="float: left" class="socialshare">
<span class="sst"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-lang="en" >Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></span>
<span class="ssg"><script type="text/javascript" src="https://apis.google.com/js/plusone.js">
  {lang: 'en'}
</script>
<g:plusone size="medium" href="{$mybb->settings['bburl']}/showthread.php?tid={$tid}"></g:plusone></span>
<span class="ssf"><iframe src="//www.facebook.com/plugins/like.php?href={$mybb->settings['bburl']}/showthread.php?tid={$tid}&amp;send=false&amp;layout=button_count&amp;width=130&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:130px; height:20px;" allowTransparency="true"></iframe></span>
<span class="ssf"><a title="Share On Facebook" href="http://www.facebook.com/share.php?u={$mybb->settings['bburl']}/showthread.php?tid={$thread['tid']}" target="_blank" style="color: #FFF;"><img src="http://myskins.org/images/fb.png" alt="Facebook" style="padding-right: 5px;padding-bottom: 2px;vertical-align: middle;"/> <b>Share</b></a></span>
</div>
<br />
Great, the last change fixed it Big Grin
Thank you, just what I wanted for my forum Smile
You're welcome.
I've updated my forum and theme and now its not working properly, check out http://image.prntscr.com/image/927959499...94808c.png
What could be causing this?
Hello again,

I have a question about this plugin:

Is there anything what should happen on Facebook, when I click the " Like" Button in a Thread?

I tried to test it several times, but it seems that there happened nothing on Facebook and in my tests a noticed an error message which appears sometimes(not every time).

When I click on the Like Button after a few secons it says sometimes "Error" instead of showing me the amount of likes and when I click on the "Error-Link" this message appears in a popup:

"Indicates that a URL property has whitespace characters, which is not allowed.: URL 'https://deinonlinebiz.de/" + spinner_image +"' for property 'og:image:url' of the object at 'https://deinonlinebiz.de/showthread.php?tid=76' is invalid because it contains whitespace characters."

Is there anyone else with this problem ? What does this mean?

Thank you!
(2017-06-09, 08:37 AM)Spinty Wrote: [ -> ]Hello again,

I have a question about this plugin:

Is there anything what should happen on Facebook, when I click the " Like" Button in a Thread?

I tried to test it several times, but it seems that there happened nothing on Facebook and in my tests a noticed an error message which appears sometimes(not every time).

When I click on the Like Button after a few secons it says sometimes "Error" instead of showing me the amount of likes and when I click on the "Error-Link" this message appears in a popup:

"Indicates that a URL property has whitespace characters, which is not allowed.: URL 'https://deinonlinebiz.de/" + spinner_image +"' for property 'og:image:url' of the object at 'https://deinonlinebiz.de/showthread.php?tid=76' is invalid because it contains whitespace characters."

Is there anyone else with this problem ? What does this mean?

Thank you!

Have the same problem. How to solve it?
Pages: 1 2