Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to add a twitter button to your MyBB forum
#1
[TUT] Adding a twitter button to your forum

This is a tutorial on how to add a twitter / tweet button to the postbit, this means that it'll appear at the bottom of every post including the initial one.

We will be editing two template files.

Note: Any member that wishes to tweet must have their own twitter account.


Steps

1) Go to http://twitter.com/goodies/tweetbutton and select the tweet button that you would like to use.

I went with "No count".

The button looks like this: [Image: mcompute-twitter-5.png]

The HTML looks like this:
Code:
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="mcomputeforums">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

2) Log into your forum and go to

Admin CP > Templates & Style > Templates > *your template* > Post Bit Templates > postbit

Find:
Code:
{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_rep']}

and add

Code:
{$post['button_twitter']}

to the end so it looks like

Code:
{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_rep']}{$post['button_twitter']}

Save the template.

3) Now, go to Admin CP > Templates & Style > Templates > *your template* > Post Bit Templates > Add Template

Template name: postbit_twitter

Mine looks like this

Code:
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="mcomputeforums">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
Save the template.


4) Download and open the file

Code:
inc/functions_post.php

And add the following

PHP Code:
eval("\$post['button_twitter'] = \"".$templates->get("postbit_twitter")."\";"); 

Save and re-upload the file, replacing the old one.


Further Explanation

So you've finished or.. you want to know what it looks like before you start changing things.

Live demo: http://mcompute.co.uk

postbit view
[Image: mcompute-twitter-2.png]

pop out view (When the button is pressed)
[Image: mcompute-twitter-3.png]

End result, what it looks like on twitter.
[Image: mcompute-twitter-4.png]

Original tutorial: http://mcompute.co.uk/showthread.php?tid=616
Reply
#2
Well, I couldn't find it anywhere. Great help posting it.
Reply
#3
No problem! Glad it was of help. Smile
Reply
#4
This is a great tutorial! Thank you for posting as I'll probably give this to my forum what is in developing.
[Image: 2dmd5j.png]
Reply
#5
This will also for Like buttons for Facebook too, Oui.
Reply
#6
thanks for this tut..
Reply
#7
(12-12-2010, 04:24 PM)Lith Wrote: This will also for Like buttons for Facebook too, Oui.

It's very similar, but the like code is different. Tutorial here.
[MyBB] [TUT] How to add a Facebook "Like" button to your forum
Reply
#8
Thanks for this tutorial, I'll add this to my forum later today. It's much appreciated, keep up with the high quality tutorials matey! Smile
Reply
#9
Really cool tutorial, I might give this a go on my test forum, just for fun.
Reply
#10
(12-13-2010, 06:09 PM)ImALovelyBoy Wrote: Thanks for this tutorial, I'll add this to my forum later today. It's much appreciated, keep up with the high quality tutorials matey! Smile

(12-14-2010, 12:30 PM)Robie Wrote: Really cool tutorial, I might give this a go on my test forum, just for fun.

Thank you for the positive feedback!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [MyBB] Problems after forum migration m1n3rman 2 1,241 07-04-2013, 03:46 PM
Last Post: Wolf
  myBB Forum Permission Cache Error - Crippling My Forum CruciasNZ 1 930 04-24-2013, 12:11 AM
Last Post: Kevin Cheri
  MYBB FORUM PERSISTENT ISSUE WITH LOGGING IN caclarkfrieson 10 4,661 06-02-2012, 03:22 PM
Last Post: caclarkfrieson
  MyBB Twitter Plugin like on SF. Snow. 5 1,870 05-02-2012, 07:22 AM
Last Post: Kewlz
  [HELP] Problem in search button IPE_1202 2 528 03-31-2012, 01:29 AM
Last Post: Verspil

Forum Jump:


Users browsing this thread: 3 Guest(s)