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)

Flep 01-29-2010 06:57 AM

@ buro9
I fixed it.
I am using the following classes:
http://code.google.com/p/bitly/
http://twitter.slawcup.com/twitter.class.phps
My vbulletin plugin becomes:
PHP Code:

$excludedForums = array(0); 
     
    if (!
in_array($foruminfo[forumid], $excludedForums)) { 
        
$shortUrl 'http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid];
     
        include 
'BitLy.php'
        
$bitly = new Bitly('<bit.ly username>''<bit.ly API key>'); 
        
$shortUrl $bitly->shortenSingle($shortUrl);  
     
        
$tweet ''
        if (isset(
$newpost['prefixid']) && $newpost['prefixid'] != '') { 
            
$tweet $vbphrase['prefix_'.$newpost['prefixid'].'_title_plain'].' '
        } 
        
$tweet .= $newpost['title'].' '.$shortUrl;
     
    include 
'twitter.php'
    
$t= new twitter();  
    
$t->username='twitter username';  
    
$t->password='twitter password';  
    
$t->update($tweet); 
    } 


Athena1984 01-29-2010 12:06 PM

I am not getting any errors but I am not getting any updates either. I'm sure I've done everything according to the instructions.

cagbaazee 01-29-2010 01:16 PM

Sorry .. too bad.. it doesnot works, after i follow the instruction..

pepsicola38 01-29-2010 02:30 PM

This sounds cool I will try it out tomorrow (too tired now.) Is it possible to have it tweet blog and/or cms articles also? or only threads? Either way I will try it out tomorrow!

Moondust 01-29-2010 04:40 PM

We can only feed new threads..... bu we can we feed answers in Threads ?

Jesh 01-29-2010 06:14 PM

Quote:

Originally Posted by Athena1984 (Post 1969748)
I am not getting any errors but I am not getting any updates either. I'm sure I've done everything according to the instructions.

I had the same issue, was missing a closing } at the end, did not copy/paste correctly from the code. I'm surprised it didnt give me an error with the statement not being closed.

DUI_ 01-29-2010 09:17 PM

I have attached the error I am receiving after posting a thread. The thread posts correctly but does not send to twitter. Any advice?

tobe12 01-29-2010 10:36 PM

I am getting the following error after posting a new thread:
Fatal error: Call to undefined function curl_init() in /home/ddddd/public_html/forums/bitly.php on line 145

zachsg 01-29-2010 10:51 PM

Quote:

Originally Posted by Jesh (Post 1969942)
I had the same issue, was missing a closing } at the end, did not copy/paste correctly from the code. I'm surprised it didnt give me an error with the statement not being closed.

I fixed my issue as well, though my problem was I didn't comment out the description at the top. Commented that out and it works amazingly.

Thanks!

Videx 01-30-2010 01:52 AM

Well, I swear I've been over my code 10 times with a fine tooth code-comb and it's fine. And I even had bit.ly reset my API. But I'm still getting the auth errors "You must be authenticated to access shorten on line 193 in ...".

I can disable bit.ly and the twitter stuff works.

I wonder: Can I simply exclude my Admin category number, rather than excluding each separate forum under it (moderators, super moderators, etc.)?

edit: No, you cannot exclude categories. You must list each separate forum.

imported_nimbus 01-30-2010 03:08 AM

Let me share my solution.

bitly.php:
I set the following Curl options:
$options[CURLOPT_FOLLOWLOCATION] = false;
$options[CURLOPT_HEADER] = false;

and for twitter.php:
$options[CURLOPT_FOLLOWLOCATION] = false;

Then all error messages gone! :)

LbR 01-30-2010 06:35 AM

This tool is insane, I get 500+ Guests after every thread is posted woha!! thanks man

Athena1984 01-30-2010 06:35 AM

Quote:

Originally Posted by Jesh (Post 1969942)
I had the same issue, was missing a closing } at the end, did not copy/paste correctly from the code. I'm surprised it didnt give me an error with the statement not being closed.


Oh, it works now! Thanks Jesh!:)

murekhalir 01-30-2010 06:40 AM

This is SEXY.

tobe12 01-30-2010 08:28 AM

I enabled CURL in Apache, and now this Mod is working for be . Thank you very much.

buro9 01-30-2010 08:49 AM

What fun getting this stuff working.

So it all seems to boil down to making sure:
1) CURL is installed and enabled for PHP
2) JSON is enabled
3) You've put the right values in the plugin
4) The moon cycle is aligned with mars

Works a dream once you get past your environment's issues though.

I'm still looking for someone to help package this if people would like that.

JADM 01-30-2010 10:18 AM

Outstanding! Thank you.

I had no problems whatsoever in making this work...however, I did take a little bit of time to figure out what needed to be inserted into the plugin code. To save anyone else the extra few minutes, you are basically just replacing the info in between the < > symbols.

Videx 01-30-2010 12:34 PM

Quote:

Originally Posted by JADM (Post 1970370)
To save anyone else the extra few minutes, you are basically just replacing the info in between the < > symbols.

Uh no. You're supposed to replace the <> symbols AND everything between them.

PS I am not seeing any sort of influx of guests; certainly not 500. But then we've never had a presence and have few followers. Not sure what we could do with 500 lurkers knocking about anyway.

lovechandigarh 01-30-2010 12:42 PM

Great! Working at http://twitter.com/love_punjab for http://www.lovepunjab.com

Nordinho 01-30-2010 02:55 PM

Quote:

Originally Posted by buro9 (Post 1970333)
4) The moon cycle is aligned with mars

Damn, forgot that ;)

lovechandigarh 01-30-2010 03:57 PM

Quote:

Originally Posted by lovechandigarh (Post 1970451)

Installed it on another of my sites www.lovechandigarh.com working on vb 3.x.
Thanks again... Appreciated!

Alibass 01-30-2010 11:22 PM

Quote:

Originally Posted by imported_nimbus (Post 1970242)
Let me share my solution.

bitly.php:
I set the following Curl options:
$options[CURLOPT_FOLLOWLOCATION] = false;
$options[CURLOPT_HEADER] = false;

and for twitter.php:
$options[CURLOPT_FOLLOWLOCATION] = false;

Then all error messages gone! :)

Mate this done the trick for me. Mine is working as it should be now. Thanks for posting. :)

Alibass 01-30-2010 11:34 PM

@buro9

Fantastic mod mate and thanks for sharing. It's really bringing in the traffic! :D

Jesh 01-30-2010 11:40 PM

Quote:

Originally Posted by LbR (Post 1970294)
This tool is insane, I get 500+ Guests after every thread is posted woha!! thanks man

I didn't see an increase, but my site is very new. I got about 20 spiders hit me at once though.

Bouncer222 01-31-2010 04:02 AM

Quote:

Originally Posted by buro9 (Post 1969320)
Feel free to PM me your plugin PHP and I'll take a look.

Do you not get any errors at all visible?

Here is my php.. what did I do wrong?


HTML 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(0);

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

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

    if ($useBitly) {
      // http://classes.verkoyen.eu/bitly
      require_once 'bitly.php';
      $bitly = new Bitly('bouncer', 'API KEY');
      $shortUrl = $bitly->shorten($shortUrl);
    }

    $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('bogbouncer1','passwordhere');
    $twitter->updateStatus($tweet);
}

Please someone help me :)

kall 01-31-2010 04:09 AM

You've got a space at the end of your bit.ly key (which you might want to remove from the code block here..)

Videx 01-31-2010 04:14 AM

I don't remember your specific problem, but I see you have the infamous extra space after your bitly API.

However, I still can't get bit.ly to authenticate me regardless.

Bouncer222 01-31-2010 04:21 AM

I fixed it, and now my host enabled CURL, JSON is enabled as well.. did I miss something??

EDIT: It still wont work.

Bouncer222 01-31-2010 04:41 AM

K it works, thanks to all who helped!

EDIT: wow and the second I go back to my home page, my spiders on my site went from 11 to 22 and growing...nice!

JADM 01-31-2010 06:21 AM

Quote:

Originally Posted by Videx (Post 1970441)
Uh no. You're supposed to replace the <> symbols AND everything between them.

PS I am not seeing any sort of influx of guests; certainly not 500. But then we've never had a presence and have few followers. Not sure what we could do with 500 lurkers knocking about anyway.

Okay, let's play semantics. What are you "replacing" the <> symbols with? If it is nothing, then that is not replacing them, it is deleting them AND replacing the info in between them.

Don't know why this would warrant a snarky comment from you and, even more, one that takes exception to the post and then seeks to correct it with....wait for it....an equally incorrect statement.

iguano 01-31-2010 09:50 AM

It works but when i go on twitter i see "unknow file"and when i click on the link come out 404 Not Found

( Not Found

The requested URL /showthread.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.)

cagbaazee 01-31-2010 01:35 PM

With due regards I would like to bring to your kind notice and would like

to have your kind favour in solving my problem.

1. When some one post it immediately goes to twitter site and by clicking

on it - it displays "No Thread specified. If you followed a valid link,

please notify the administrator."

2.Secondly, When somebody adds new thread, it doesnot appears, but when he add it twice then it appear.

3. When someone post it , but it doesnot mention the name of title at bid.ly, it only mention gs community

I, therefore, like to have your kind favour to get it solved as soon as

possible as I need the "TITLE" to be displayed. Kindly guide me in this

matter.

Regards
copy of screenshot here

buro9 01-31-2010 01:40 PM

Quote:

Originally Posted by iguano (Post 1971125)
It works but when i go on twitter i see "unknow file"and when i click on the link come out 404 Not Found

( Not Found

The requested URL /showthread.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.)

Do you have your forums in a different folder? Did you adjust the URL to match your forums?
Quote:

Originally Posted by cagbaazee (Post 1971249)
With due regards I would like to bring to your kind notice and would like

to have your kind favour in solving my problem.

1. When some one post it immediately goes to twitter site and by clicking

on it - it displays "No Thread specified. If you followed a valid link,

please notify the administrator."


2.Secondly, When somebody adds new thread, it doesnot appears, but when he add it twice then it appear.

3. When someone post it , but it doesnot mention the name of title at bid.ly, it only mention gs community

I, therefore, like to have your kind favour to get it solved as soon as

possible as I need the "TITLE" to be displayed. Kindly guide me in this

matter.


Regards
copy of screenshot here

1) Do you have your forums in your forum root? Did you adjust the URL to match your site?

2) There's no reason for it to be called twice, the plugin will either work all the time, or fail all the time. Please double-check the instructions.

3) Twitter will show precisely what you tell it to, bit.ly statistics on the other hand will go and fetch the page and will show the title of the page it fetched. So in the case of bit.ly it is resolving and fetching the URL and show the title of that page. You've already said that problem #1 is that you get a 404 not found, which suggests that your URL is wrong. bit.ly is showing the title of your 404 page because that's currently where the URL ends. Fix #1 and #3 will also be fixed.

cagbaazee 01-31-2010 01:47 PM

No i donot any other forum at my site , just one forum.

2. can u tell how to fix it #1 & #3.. do i hv install and follow the instruction again.

Do reply

Thanks

Quote:

Originally Posted by buro9 (Post 1971258)
Do you have your forums in a different folder? Did you adjust the URL to match your forums?

1) Do you have your forums in your forum root? Did you adjust the URL to match your site?

2) There's no reason for it to be called twice, the plugin will either work all the time, or fail all the time. Please double-check the instructions.

3) Twitter will show precisely what you tell it to, bit.ly statistics on the other hand will go and fetch the page and will show the title of the page it fetched. So in the case of bit.ly it is resolving and fetching the URL and show the title of that page. You've already said that problem #1 is that you get a 404 not found, which suggests that your URL is wrong. bit.ly is showing the title of your 404 page because that's currently where the URL ends. Fix #1 and #3 will also be fixed.


buro9 01-31-2010 01:54 PM

See this bit:
PHP Code:

$shortUrl 'http://www.yourforumsdomain.com/showthread.php?t='.$newpost[threadid]; 

I'm pretty sure you've set it to:
PHP Code:

$shortUrl 'http://www.gurusecret.info/showthread.php?t='.$newpost[threadid]; 

When it should be:
PHP Code:

$shortUrl 'http://www.gurusecret.info/vbforum/showthread.php?t='.$newpost[threadid]; 

Assuming I've googled correctly and that is your site.

cagbaazee 01-31-2010 02:20 PM

here is my config..

// 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(7);

if (!in_array($foruminfo[forumid], $excludedForums)) {
// http://classes.verkoyen.eu/bitly
require_once 'bitly.php';

// http://classes.verkoyen.eu/twitter/
require_once 'twitter.php';

$bitly = new Bitly('guru', 'R_d3383e27ad33b187a20e78d68c063be');
$shortUrl = $bitly->shorten('http://www.mysite.info/vbforum/showthread.php?t='.$newpost[threadid]);

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

$twitter = new Twitter('guru','mypassword');
$twitter->updateStatus($tweet);
}

please check whether is it okay or not

If it s okay.. but i didnot make any change on it . it is same config what i do.
or if it is wrong then please explain correct config.

Do reply

tenjinzan 02-01-2010 12:40 PM

Got it working perfectly first try. I read through the comments here, but I didn't see it (I may have missed, so forgive me if I did). Is there a way to include the Poster's name in the tweet? I'm not sure what the syntax would be for the tweet line.

Basically, I just want it to say "Thread name" by "Poster" ... bit.ly/url I can see WHERE to put it, but I'm not sure of the variable that refers to the poster of a thread.

tobe12 02-01-2010 06:45 PM

Is there a way to make it tweet RSS feeds as well?

nextslit 02-04-2010 02:01 AM

I would like to thank you for this great mod buro9 , realy nice try : )
and working perfect in 4.0.1

Videx 02-04-2010 02:26 AM

Not working with the new BBR - vB Event Forums. Posting an event doesn't tweet the event. :(


All times are GMT. The time now is 01:02 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.03621 seconds
  • Memory Usage 1,855KB
  • 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_html_printable
  • (4)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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