vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Miscellaneous Hacks - vBulletin to Twitter, live tweets of new threads (https://vborg.vbsupport.ru/showthread.php?t=234288)

RFLIndustries 05-20-2013 09:35 PM

I'm getting the error of

Could not authenticate you on line 204 in /home/bullpen/public_html/twitter.php
#0 /home/bullpen/public_html/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /home/bullpen/public_html/newthread.php(277) : eval()'d code(57): Twitter->updateStatus('testing http://...')
#2 /home/bullpen/public_html/newthread.php(277): eval()
#3 /home/bullpen/public_html/vbseo.php(1398): require('/home/bullpen/p...')
#4 {main}


Fatal error: Could not authenticate you on line 204 in [path]/twitter.php in [path]/vb/vb.php on line 286

I know it says its not supported. but hopefully somebody has some ideas.

Videx 05-20-2013 10:29 PM

Quote:

Originally Posted by RFLIndustries (Post 2423255)
I know it says its not supported. but hopefully somebody has some ideas.

https://vborg.vbsupport.ru/showpost....&postcount=614

Ross L 05-25-2013 08:23 PM

Quote:

Originally Posted by cuco88 (Post 2340684)
I tried this with my 4.2.0-board. It didn't work, the bit.ly-thing threw out errors. After fixing that the twitter-thing threw out other and more complicated errors. I tried to fix it and I got it working. But many changes were needed. I try to tell you:

At first, don't use the attached bitly.php. Use the linked one in the first posting. Or take this link:
http://classes.verkoyen.eu/bitly
unzip it, place it in the forum-root

Second: the twitter-API only accepts oAuth now, no basic username/password authentication anymore. So you have to use the new twitter.php. Don't use the one attached to the first posting. And don't use the one linked in the first posting. Use this one instead: http://classes.verkoyen.eu/twitter_oauth
unzip it. Don't place it in the forum root now! We have to edit it!

Now you have to get a legacy-API-key from bit.ly: https://bitly.com/a/settings/advanced
And you need oAuth-data from twitter. Use this link: https://dev.twitter.com/ then click on "my applications" in the menu on the upper right. Click on "create new application" and enter your data. (you don't need to enter a callback-url) Then your app is created. Click on "settings" and then switch to "Read, Write and Access direct messages". Update application settings. Go back on the "details"-tab and click on "create my access-token". Go to tab "oAuth tool" You will see four keys now. You need all of them. Open your twitter.php, search for "private $oAuthToken = ' ';" Place the "Access token" here. Then search for "private $oAuthTokenSecret = ' ';" Place your "Aceess token secret" between the ' ' here. Now save the file and upload it to your forum root. The other two codes (consumer key, consumer secret) are needed in the plugin-script, see below.

Go to plugin-manager and create a new plugin:
vBulletin
newthread_post_complete
Tweet to Twitter

Now use the following code
If you want to exclude some forums, edit this line:
$excludedForums = array(1, 2);
and place the forum-ids between the brackets. use array() if you don't want to exclude any forums.

this line:
$shortUrl = 'http://yourURLhere.com/showthread.php?t='.$newpost[threadid];
change "YourURLhere.com" to your forum-URL.

In this line:
$bitly = new Bitly('username', 'API_key');
you have to put in your bit.ly-username and the generated API-key.

And in this line:
$twitter = new Twitter('consumer-key','consumer-secret');
you have to put in the consumer-key and the consumer-secret from the twitter o-auth-tool.


PHP Code:

// The array below are the ids of non-public forums, update these to be your admin forum ids or anything non-public by default
$excludedForums = array(12);

// If you are having trouble getting bitly URL shortening to work... disable it!
$useBitly true;

if (!
in_array($foruminfo[forumid], $excludedForums)) {
    
$shortUrl 'http://yourURLhere.com/showthread.php?t='.$newpost[threadid];

    if (
$useBitly) {
      
// http://classes.verkoyen.eu/bitly
      
require_once 'bitly.php';
      
$bitly = new Bitly('username''API_key');
      
$result_bit = array();
      
$result_bit $bitly->shorten($shortUrl);
      
$shortUrl $result_bit['url'];
    }

    
$tweet '';
    if (isset(
$newpost['prefixid']) && $newpost['prefixid'] != '') {
        
$tweet $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' ';
    }
    
$tweet .= $newpost['title'].' '.$shortUrl;

    
// http://classes.verkoyen.eu/twitter/
    
require_once 'twitter.php';
    
$twitter = new Twitter('consumer-key','consumer-secret');
    
$twitter->statusesUpdate($tweet);


Save and activate it. This worked for me :-) No curl-erros anymore, no "unauthorized access" errors anymore, no .... errors, just working :)

I followed your instructions and I am getting the following error on submission:

Fatal error: Namespace declaration statement has to be the very first statement in the script in /home/xxxx/public_html/twitter.php on line 2

Any ideas on what could be causing this?

Thanks in advance.

Black Tiger 07-04-2013 08:57 AM

Does this still work after Juli 1st this year or in any case since twitter isn't using api 1.0 anymore?
Because the other similar mods are not working anymore.

Videx 07-04-2013 10:26 AM

Quote:

Originally Posted by Black Tiger (Post 2432004)
Does this still work after Juli 1st this year or in any case since twitter isn't using api 1.0 anymore?
Because the other similar mods are not working anymore.

https://vborg.vbsupport.ru/showpost....&postcount=614

Black Tiger 07-04-2013 11:41 AM

Thank you!

Black Tiger 07-10-2013 11:34 PM

Pity though, that one only posts thread titles, no mod with part threads anymore.:(

Joe Pimms 09-03-2013 03:33 PM

is there an update to use google

Videx 09-03-2013 04:41 PM

No updates, but it is reusable code and that sounds like a great idea. I'm good for some money to hire a coder.

giaco750 01-09-2014 02:41 AM

Is there a way that we can authorize before it gets tweeted on twitter TWEET :)?


All times are GMT. The time now is 01:07 AM.

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.01687 seconds
  • Memory Usage 1,763KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete