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
vBulletin 2 Twitter - Take Your News Straight To Twitter! Details »»
vBulletin 2 Twitter - Take Your News Straight To Twitter!
Version: .1b, by AHealthForum AHealthForum is offline
Developer Last Online: Jul 2012 Show Printable Version Email this Page

Category: Add-On Releases - Version: 3.8.1 Rating:
Released: 03-15-2009 Last Update: 03-15-2009 Installs: 132
Additional Files  
No support by the author.

vBulletin2 Twitter Courtesy A Health Forum http://ahealthforum.com
Special Thanks to Jarvis From http://seovb.com for help
vbtotwitt.php copyright Vojtech Semecky released under the terms of GPL
================================================== =========

This modification will take one of your latest news threads and post it directly to your twitter account. You must have RSS enabled for this modification to work. You can specify a forum to pull the content from using external.php?f=FORUMID

The RSS feed will post your thread title directly into your Twitter account, and then create a link back using TinyURL. The links are automatically converted into tinyurl.com links via the TinyURL API


Install instructions

1. Upload the includes folder into your forum root. This will automatically place the 2 scripts need to operate this into the "includes/cron/" folder
2. Install the product-ahealthforumcomvbtwit.xml file via the Product Manager in your adminCP
3. Navigate to vBulletin Options -> vBulletin Options -> vBulletin 2 Twitter and enter your name and password.
4. Hit Save and Wait 2 minutes
5. View your twitter account to confirm that an update was posted.
6. Enter the URL to your forum feed.

Notice: By default for testing purposes this makes one tweet announcing you've installed vB2Twitter You are free to delete this tweet as it is for testing purposes only!!!!

================================================== =============

vBulletin 2 Twitter Options

1. Twitter Username: This is your Twitter.com username. If you don't have one yet, you can get one for free at http://twitter.com

2. Twitter Password: This is your password for your twitter account. Notice that its not hashed or encypted so anyone with adminCP access can view it. If you can't trust those who have your AdminCP information with such details, then this mod isn't for you sorry.

3. Feed URL: This can be to any sites feed if you want, but I suggest pointing it to your news forum and creating a prefix such as [Breaking News] to make the most of this. Your twitter posts will then be prefixed with [Breaking News] Thread Title link to thread.

================================================== ===========


Again, this modification will take the latest thread from the forum RSS feed you specify. I don't beleive in spamming on twitter with useless crap, so I've made this modification to only take one thread at a time from your forums RSS feed.


Trouble Shooting:

If it does not automatically update to your account. Go into the scheduled tasks manage and run the task manually.

external.php gives a blank page. Enable RSS from your vBulletin Admin Control Panel.

Download Now

File Type: zip vBulletin2Twitter.zip (5.8 KB, 1254 views)

Show Your Support

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

Comments
  #52  
Old 04-19-2009, 03:41 PM
A825F933D42B A825F933D42B is offline
 
Join Date: Dec 2007
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

my server does not support curl. Is there a no-curl option?
Reply With Quote
  #53  
Old 04-21-2009, 12:32 PM
skylab's Avatar
skylab skylab is offline
 
Join Date: Feb 2009
Location: Everywhere
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not a huge issue but hopefully the CDATA gets fixed sooner or later.
Reply With Quote
  #54  
Old 05-02-2009, 05:35 PM
SBlueman SBlueman is offline
 
Join Date: Jan 2006
Posts: 717
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this work at all for v3.6.12? I tried it and got the CDATA issue too. Might it have something to do with thread prefixes?
Reply With Quote
  #55  
Old 05-03-2009, 02:04 PM
beachinxj beachinxj is offline
 
Join Date: Mar 2006
Location: USA
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way to make it not do duplicate threads other than increasing the time between script runs?
Reply With Quote
  #56  
Old 05-04-2009, 03:05 AM
fbriceno97 fbriceno97 is offline
 
Join Date: Jun 2008
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got same error:

Error: RSS file not found, dude, when using the scheduled task... external.php is perfectly working as we have it on viigo, php5.... everything is ok, but that error is present.

How do i solve it?
Reply With Quote
  #57  
Old 05-07-2009, 09:21 PM
kalliey kalliey is offline
 
Join Date: Dec 2007
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hy thanks for this great Hack! :-)

I´ve only one problem, my letters Ö,Ü,Ä dont´t send to twitter, how can i fix this?
Reply With Quote
  #58  
Old 05-13-2009, 12:59 PM
sevkotr sevkotr is offline
 
Join Date: Nov 2008
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

turkish characters can not be sent to twitter via this mod. is there anything which i can do to fix this?

i changed utf-8 to latin5 but did not worked.
Reply With Quote
  #59  
Old 05-14-2009, 09:09 AM
just77me just77me is offline
 
Join Date: Jun 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i get many duplicate threads to twitter - whats going wrong there? if there is no solution - i have to uninstall this twitter tool because i dont want to flood twitter with duplicate content and delete ist manual.

any ideas?

thank you
Reply With Quote
  #60  
Old 05-15-2009, 03:34 PM
Vanjezi's Avatar
Vanjezi Vanjezi is offline
 
Join Date: Apr 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can u make to all rss?

Its missing a lot threads posts
Reply With Quote
  #61  
Old 05-16-2009, 05:27 PM
gordietbh gordietbh is offline
 
Join Date: Feb 2009
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

here is the code I've implemented to get around the duplicate issue.

The issue arose when the latest thread was not the current status of the twitter account, so I updated the code to search the entire feed page for the thread title. It now checks the contents of your twitter page and looks for a match with the title of the first item in the RSS feed, if it finds it it does not try to repost. If it does not find a match it will call the twitter API and submit the message.

I then had an issue where it was posting <![CDATA[thread title]]. I discovered that this only occurred when there was an apostrophe in the thread title, so I added a replace command to strip out the CDATA text.

There was also an issue where if your server did not receive a response from the twitter page in a timely fashion the script would not find a match for the latest title thread and would repost. I added a line in the script to search for your account name in the page, and if it finds it then call the twitter API. This ensures that there is no more double posting.

You need to replace the contents of the twitask.php file in the includes\cron folder with the script below. You need to replace the ACCOUNTNAME text in the line http://twitter.com/ACCOUNTNAME with the name of your twitter account. this needs to be in the same case as the account name appears on your twitter page.

PHP Code:
<?php
// vBulletin2Twitter Provided Via http://ahealthforum.com
// Inspiration from Reuqests and various free open source scripts
// twitask.php may not be reproduced without prior written permission
// See vbtotwitt.php for open source script usage
// 
// Set error status
error_reporting(E_ALL & ~E_NOTICE);

// Check database connection
if (!is_object($vbulletin->db))
{
    exit;
}
include_once(
'vbtotwitt.php');
$u $vbulletin->options['vb2twitter_u'];
$p $vbulletin->options['vb2twitter_p'];
$twurl 'http://twitter.com/statuses/update.xml';
$f $vbulletin->options['vb2twitter_f']; 
$rss = new lastRSS;
if (
$rs $rss->get($f)){
    
$title $rs[items][0][title];
    
$url $rs[items][0][link];
} else { die(
'Error: RSS file not found, dude.'); }

$title str_replace("<![CDATA[""""$title"); 
$title str_replace("]]>""""$title"); 
$title str_replace("&""and""$title"); 

$tiny_url =  file_get_contents("http://tinyurl.com/api-create.php?url=" $url);
$status $title " " $tiny_url;
echo 
$status//just for status if you are directly viewing the script

$twitterfeed file_get_contents("http://twitter.com/ACCOUNTNAME");

$stringtocheckfor $title;
if(
strstr($twitterfeed,$stringtocheckfor)) {
    echo 
"<br />status update already exists";
} else {

    
$accountstring $vbulletin->options['vb2twitter_u'];
    if(
strstr($twitterfeed,$accountstring)) {

        
$curl_handle curl_init();
        
curl_setopt($curl_handle,CURLOPT_URL,"$twurl");
        
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
        
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
        
curl_setopt($curl_handle,CURLOPT_POST,1);
        
curl_setopt($curl_handle,CURLOPT_POSTFIELDS,"status=$status");
        
curl_setopt($curl_handle,CURLOPT_USERPWD,"$u:$p");
        
$buffer curl_exec($curl_handle);
        
curl_close($curl_handle);
        if (empty(
$buffer)){echo '<br/>message';}else{echo '<br/>success';}
    
        
// log message
        
$logmsg 'Twitter Update';

        
// Output Log Status
        
log_cron_action($logmsg$nextitem);
    } else {
        echo 
'<br />twitter page not found';
    }
}


?>
If you have $cronimage in your footer template and have the twitter scheduled task set to run every minute each time a new thread is started the title will be updated. You will also need to set the refresh time on your RSS feed in vboptions to 0 if you want to ensure that every new thread is updated to your twitted feed. If the refresh time is 60 minutes you will only have the latest thread submitted every hour when the RSS cache is refreshed.

I've been running with the above script and options for the last several days and have eliminated the duplicate posting issues.
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 10:54 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05121 seconds
  • Memory Usage 2,367KB
  • Queries Executed 28 (?)
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
  • (1)bbcode_php
  • (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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)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_postinfo_query
  • fetch_postinfo
  • 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