Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vBTwitter Details »»
vBTwitter
Version: 1.0.4, by King Kovifor King Kovifor is offline
Developer Last Online: Aug 2015 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.8.x Rating:
Released: 02-08-2009 Last Update: 07-13-2009 Installs: 402
DB Changes Uses Plugins Auto-Templates
Additional Files Translations  
No support by the author.

Description

This modification adds basic Twitter integration to vBulletin. Once a user defines their Twitter username & password within their vB Options (User CP -> Edit Options), the Tweet This X links will appear.

It automatically adds a tweet to their account with the default text of "Check this out! " (which can be edited editing the "twitter_checkout" phrase) and uses your forum URL with either tp or tt.php as the link. These redirect to the thread / post that was tweeted.

Installation
  1. Upload files in the /upload/ folder of the .zip into the directories as is.
  2. Install product file.
  3. Register an OAuth Application here, using:
  4. Click Install on vB.org
  5. Tell Your users.
  6. Enjoy
Upgrading to v1.0.4
  • Upload all files, overwrite everything.
  • Install product file.
  • Register an OAuth Application here, using:
  • Gain and copy the Consumer Key & Secret into vBulletin Options.
Upgrading to v1.0.3 or before.
  • Upload all files, overwrite everything.
  • install product file.
  • Remove template edits. For the record, they are here:
    • Open the postbit or postbit_legacy template (depending on what you use). Find:
      HTML Code:
      <if condition="$show['postcount']">#<a href="showpost.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]" target="new" rel="nofollow" id="postcount$post[postid]" name="$post[postcount]"><strong>$post[postcount]</strong></a></if>
      Add before that:
      HTML Code:
      <if condition="$post['twitter_username']"><a href="tweet.php?do=post&amp;id=$post[postid]&amp;c=$post[postid]">Tweet this post!</a></if>
    • Open the SHOWTHREAD template.
      Find:
      HTML Code:
      	<if condition="$show['addpoll']">
      	<tr>
      		<td class="vbmenu_option"><img class="inlineimg" src="$stylevar[imgdir_button]/addpoll.gif" alt="$vbphrase[add_a_poll]" /> <a href="poll.php?$session[sessionurl]do=newpoll&amp;t=$threadinfo[threadid]">$vbphrase[add_a_poll_to_this_thread]</a></td>
      	</tr>
      	</if>
      Add After:
      HTML Code:
      	<if condition="$vbulletin->userinfo['twitter_username']">
      	<tr>
      		<td class="vbmenu_option">
      			<a href="tweet.php?do=thread&ampid=$threadinfo[threadid]">Tweet This  Thread!</a>
      		</td>
      	</tr>
      	</if>
      Find:
      HTML Code:
      		<if condition="!$show['search_engine']">
      
      			<div><img class="inlineimg" src="$stylevar[imgdir_button]/printer.gif" alt="$vbphrase[show_printable_version]" vspace="1" /> <a href="printthread.php?$session[sessionurl]t=$threadid" rel="nofollow">$vbphrase[show_printable_version]</a></div>
      			<div><img class="inlineimg" src="$stylevar[imgdir_button]/sendtofriend.gif" alt="$vbphrase[email_this_page]" vspace="1" /> <a href="sendmessage.php?$session[sessionurl]do=sendtofriend&amp;t=$threadid" rel="nofollow">$vbphrase[email_this_page]</a></div>
      		</if>
      Add After:
      HTML Code:
      		<if condition="$vbulletin->userinfo['twitter_username']"><a href="tweet.php?do=thread&amp;id=$threadinfo[threadid]">Tweet This  Thread!</a></if>
Requirements

THIS MODIFICATION REQUIRES PHP 5 DUE TO THE CLASS THAT IS USED!

PHP'S CURL EXTENSION IS ALSO USED! THE API CALLS ARE COMPLETELY DEPENDENT ON THEM!


This modification should work on vBulletin v3.5+, but was only tested on a vB 3.8 install.

Using the "tp.php" switch added in v1.0.2

With the release of v1.0.2, a switch between showpost.php?p=ID&postcount=COUNT and showthread.php?p=ID#postID has been added. Using it is simple, but requires a code edit (Note: This is a SUPPORTED code edit!). Open up tp.php and find this line:

PHP Code:
define('SHOWPOST'true); 
Change that line to this:

PHP Code:
define('SHOWPOST'false); 

This will automatically trigger the change any time it is loaded. This works retroactively and any links will automatically use the new settings once changed!

Download Now

File Type: zip vBTwitter v1.0.4.zip (13.2 KB, 1233 views)

Screenshots

File Type: jpeg tweet1.jpg.jpeg (81.8 KB, 0 views)
File Type: jpeg tweet2.jpg.jpeg (89.5 KB, 0 views)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #572  
Old 08-13-2009, 04:22 AM
rjerina rjerina is offline
 
Join Date: Jan 2004
Location: Cleveland, OH
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried searching but didn't find anything, but instead of storing password or prompting for a password, how do sites like Twitpic etc authenticate? They somehow pick up your authentication to twitter and they just work, I assume with something through the API.

Forgive me if this was posted already. I am interested in this but don't want to store any passwords unencrypted if possible and very little use integration.
Reply With Quote
  #573  
Old 08-13-2009, 03:16 PM
johnbmtl johnbmtl is offline
 
Join Date: Dec 2007
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I click on the link in th euser options "Setup integration by clicking here."

I get the following from the twitter site:

Woah there!
This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.

Did I miss something in the installation?

------------------
Update: Yes I did miss something in the installation.
The instructions to register an OAuth Application which appear under the Upgrading instructions also apply to new installations.

Everything works fine now.
Reply With Quote
  #574  
Old 08-13-2009, 09:35 PM
ClipBucket's Avatar
ClipBucket ClipBucket is offline
 
Join Date: Feb 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To post the title for threads to Twitter, edit tweet.php
Find the section that starts with:

PHP Code:
if($_GET['do'] == 'thread')


Find:

PHP Code:
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $vbphrase['twitter_checkout'] . $vbulletin->options['bburl'] . '/tt.php?i=' $vbulletin->GPC['id']), 'POST'); 

Change to:

PHP Code:
$thread $db->query_first("SELECT title FROM " TABLE_PREFIX "thread WHERE threadid = " $vbulletin->GPC['id']);
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $thread['title'] .'&nbsp;-&nbsp;'$vbulletin->options['bburl'] . '/tt.php?i=' $vbulletin->GPC['id']), 'POST'); 

This only works when Twittering a thread.
I have not looked into sending post titles yet, though it should also be trivial.
Reply With Quote
  #575  
Old 08-13-2009, 09:43 PM
ClipBucket's Avatar
ClipBucket ClipBucket is offline
 
Join Date: Feb 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is not tested.

To post the title for posts to Twitter, edit tweet.php
Find the section that starts with:

PHP Code:
if($_GET['do'] == 'post')


Find:

PHP Code:
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $thread['title'] .'&nbsp;-&nbsp;'$vbulletin->options['bburl'] . '/tp.php?i=' $vbulletin->GPC['id'] . '&c=' $vbulletin->GPC['c']), 'POST'); 

Change to:

PHP Code:
        $post $db->query_first("SELECT title FROM " TABLE_PREFIX "post WHERE postid = " $vbulletin->GPC['id']);
        
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $post['title'] .'&nbsp;-&nbsp;'$vbulletin->options['bburl'] . '/tp.php?i=' $vbulletin->GPC['id'] . '&c=' $vbulletin->GPC['c']), 'POST'); 
Reply With Quote
  #576  
Old 08-13-2009, 10:44 PM
King Kovifor's Avatar
King Kovifor King Kovifor is offline
 
Join Date: Nov 2004
Location: PA
Posts: 3,872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rjerina View Post
I tried searching but didn't find anything, but instead of storing password or prompting for a password, how do sites like Twitpic etc authenticate? They somehow pick up your authentication to twitter and they just work, I assume with something through the API.

Forgive me if this was posted already. I am interested in this but don't want to store any passwords unencrypted if possible and very little use integration.
Well, this doesn't prompt for a password. And twit pic, does. If you go to their site, they prompt for a username / password.

Quote:
Originally Posted by johnbmtl View Post
When I click on the link in th euser options "Setup integration by clicking here."

I get the following from the twitter site:

Woah there!
This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again ? it was probably an honest mistake.

Did I miss something in the installation?

------------------
Update: Yes I did miss something in the installation.
The instructions to register an OAuth Application which appear under the Upgrading instructions also apply to new installations.

Everything works fine now.
Guess I missed something their. *wonders why I screwed that up*.

Quote:
Originally Posted by ClipBucket View Post
To post the title for threads to Twitter, edit tweet.php
Find the section that starts with:

PHP Code:
if($_GET['do'] == 'thread')


Find:

PHP Code:
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $vbphrase['twitter_checkout'] . $vbulletin->options['bburl'] . '/tt.php?i=' $vbulletin->GPC['id']), 'POST'); 

Change to:

PHP Code:
$thread $db->query_first("SELECT title FROM " TABLE_PREFIX "thread WHERE threadid = " $vbulletin->GPC['id']);
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $thread['title'] .'&nbsp;-&nbsp;'$vbulletin->options['bburl'] . '/tt.php?i=' $vbulletin->GPC['id']), 'POST'); 

This only works when Twittering a thread.
I have not looked into sending post titles yet, though it should also be trivial.
Quote:
Originally Posted by ClipBucket View Post
This is not tested.

To post the title for posts to Twitter, edit tweet.php
Find the section that starts with:

PHP Code:
if($_GET['do'] == 'post')


Find:

PHP Code:
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $thread['title'] .'&nbsp;-&nbsp;'$vbulletin->options['bburl'] . '/tp.php?i=' $vbulletin->GPC['id'] . '&c=' $vbulletin->GPC['c']), 'POST'); 

Change to:

PHP Code:
        $post $db->query_first("SELECT title FROM " TABLE_PREFIX "post WHERE postid = " $vbulletin->GPC['id']);
        
$twitter->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $post['title'] .'&nbsp;-&nbsp;'$vbulletin->options['bburl'] . '/tp.php?i=' $vbulletin->GPC['id'] . '&c=' $vbulletin->GPC['c']), 'POST'); 
I thank you for writing this, but it has the problems within itself. It doesn't do character checking. Which is what I have done extensively for the next version.
Reply With Quote
  #577  
Old 08-13-2009, 10:57 PM
ClipBucket's Avatar
ClipBucket ClipBucket is offline
 
Join Date: Feb 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by King Kovifor View Post
I thank you for writing this....
Thanks & thanks for the original hack.

Quote:
Originally Posted by King Kovifor View Post
...but it has the problems within itself. It doesn't do character checking. Which is what I have done extensively for the next version.
It should be trivial to escape the characters.
I just threw this together quick to see if it would work.
Reply With Quote
  #578  
Old 08-13-2009, 11:51 PM
King Kovifor's Avatar
King Kovifor King Kovifor is offline
 
Join Date: Nov 2004
Location: PA
Posts: 3,872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, I have several shortening steps. It first checks it using a full URL, then shortens the URL, then the title. It should work rather well. I am stuck with v1.1 because I came to depend on AJAX a lot and my AJAX developer left.
Reply With Quote
  #579  
Old 08-14-2009, 12:14 AM
ClipBucket's Avatar
ClipBucket ClipBucket is offline
 
Join Date: Feb 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Depending on AJAX for what exactly?
By character checking, I'm assuming you meant for checking the title length?

I recommend you put the code on a service like OpenSVN, Google Code or GitHub.
PM me credentials for commit access & I will assist w/ coding.
Reply With Quote
  #580  
Old 08-14-2009, 12:21 AM
ClipBucket's Avatar
ClipBucket ClipBucket is offline
 
Join Date: Feb 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, well I just setup the project on Google Code.
Join Google Code & send me your username, so that I can give you ownership of the project.
Reply With Quote
  #581  
Old 08-14-2009, 03:53 AM
King Kovifor's Avatar
King Kovifor King Kovifor is offline
 
Join Date: Nov 2004
Location: PA
Posts: 3,872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ClipBucket View Post
Depending on AJAX for what exactly?
By character checking, I'm assuming you meant for checking the title length?

I recommend you put the code on a service like OpenSVN, Google Code or GitHub.
PM me credentials for commit access & I will assist w/ coding.
v1.1 is drastically different, and includes AJAX throughout the new features.

Quote:
Originally Posted by ClipBucket View Post
OK, well I just setup the project on Google Code.
Join Google Code & send me your username, so that I can give you ownership of the project.
Technically, since my project isn't open source, that would be copyright infringement, but, I will just politely ask you to remove it. I have the files in a SVN repository over at CodeSpaces, it is just different as my code isn't open source. If you would like to help, please PM me.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:34 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07803 seconds
  • Memory Usage 2,417KB
  • Queries Executed 27 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_html
  • (14)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (3)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete