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)

vbreal 04-03-2010 05:51 PM

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(28,72,74,88,26,81,62,25,40);

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

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

    if (
$useBitly) {
      
// http://classes.verkoyen.eu/bitly
      
require_once 'bitly.php';
      
$bitly = new Bitly('trulyfe''R_3798ebe20e93bcd8f6f2adccae0bef8f ');
      
$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('trulyfeforum','pass');
    
$twitter->updateStatus($tweet);


this is what im using but its not authenticating with bitly. any idea why

Videx 04-03-2010 06:02 PM

First, it says "use bitly=false". Second, you have a space in your bitly key.

hiker 04-08-2010 02:00 AM

I'm not able to authenticate. I've turned bitly off because I thought that was the problem, but no, so you'll see bitly=false right now.

My test forum is bogley.com/4.0. I've dropped the bitly.php and twitter.php files in the 4.0 folder. I don't need to edit those do I?

Here's what I see right after I submit a thread titled "Twitter Testing..."

/statuses/update.xml Could not authenticate you. Unauthorized on line 229 in /var/www/vhosts/bogley.com/httpdocs/4.0/twitter.php
#0 /var/www/vhosts/bogley.com/httpdocs/4.0/twitter.php(648): Twitter->doCall('statuses/update...', Array, true)
#1 /var/www/vhosts/bogley.com/httpdocs/4.0/newthread.php(262) : eval()'d code(26): Twitter->updateStatus('twitter testing...')
#2 /var/www/vhosts/bogley.com/httpdocs/4.0/newthread.php(262): eval()
#3 {main}


Here's what my code looks like:

Code:

Plugin 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(47, 37, 48, 49, 50, 45, 46);

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

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

    if ($useBitly) {
      // http://classes.verkoyen.eu/bitly
      require_once 'bitly.php';
      $bitly = new Bitly('bogley', 'R_e1602345ef71fdad93ecc8cb71232888');
      $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('TWITTERACCOUNT','TWITTERPASS');
    $twitter->updateStatus($tweet);
}

(twitter acct & password substituted)

I'm very eager to get this mod working. Thanks.

Videx 04-08-2010 02:22 AM

I have yet to see any really good reason (or solution) to why Twitter refuses to authenticate some people. It must be a server issue, but I haven't seen a solution.

Perhaps try opening a ticket at your host? Maybe do it late one night when they have nothing else to do and be sure to phrase it nicely and mark it as a low priority so they don't just fly off the handle and tell you to get lost.

Then again, perhaps some of the people having Twitter auth problems solved it but forgot to post back and tell us what the trouble was?

hiker 04-08-2010 12:32 PM

Quote:

Originally Posted by Videx (Post 2017743)
I have yet to see any really good reason (or solution) to why Twitter refuses to authenticate some people. It must be a server issue, but I haven't seen a solution.

So that's pretty much what it is, that Twitter is not authenticating the post? OK, thanks for the reply. :)

EDIT - OK I changed my twitter account to a different one that has been in use for a couple of years, made a test thread, and received this:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource 'http://www.bogley.com/4.0/newthread.php?do=postthread&...

</hash>



This was on IE8

Videx 04-08-2010 12:48 PM

Who knows. That all sounds like some sort of style issue. Are you using the default vb style? If not, you may have to revert to it at least for testing.

nervous 04-08-2010 10:03 PM

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

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

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

    if (
$useBitly) {
      
// http://classes.verkoyen.eu/bitly
      
require_once 'bitly.php';
      
$bitly = new Bitly('BitlyName''BitlyAPiKey');
      
$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('Twitteracc','TwitterPass');
    
$twitter->updateStatus($tweet);


This is my Plugin Code.But not working.Do you see any mistake?

Not: i didn't write my own twitter account name and password, at the same time bitly account name and api key also.
bitly.php and twitter.php are in my forum root folder.

Adan0s 04-11-2010 08:07 AM

anyone knows how to limit the script that threads in a forum, which first need to get moderated, don't get posted to twitter. but if a mod sets it visible it will be posted to twitter?

nstlx 04-11-2010 10:36 AM

Quote:

Originally Posted by milaszewski (Post 2013521)
Polish characters are displaying incorrectly. Any way of solving it? Please take a look: www.twitter.com/dzwiek
I use iso-8859-2 coding

I solved the problem like this:

Code:

$tweet .= utf8_encode($newpost['title'].' '.$shortUrl);
Twitter uses utf8, so it with be ok also with English....

nstlx

zipperty 04-11-2010 07:20 PM

Installed no problems instructions crystal clear. Thank you for such a useful mod.

sticky 04-12-2010 11:40 AM

I'm considering installing this as I want more traffic but won't people get offended or annoyed with every new thread being tweeted?

milaszewski 04-12-2010 12:33 PM

Quote:

Originally Posted by nstlx (Post 2019368)
I solved the problem like this:

Code:

$tweet .= utf8_encode($newpost['title'].' '.$shortUrl);
Twitter uses utf8, so it with be ok also with English....

nstlx

it doesn't work... my forum is not utf8, it's iso-8859-2

milaszewski 04-12-2010 12:44 PM

Quote:

Originally Posted by milaszewski (Post 2019912)
it doesn't work... my forum is not utf8, it's iso-8859-2

solved!
I added this line:
$tweet = iconv("ISO-8859-2", "UTF-8", $tweet);

Videx 04-12-2010 10:18 PM

Quote:

Originally Posted by sticky (Post 2019891)
I'm considering installing this as I want more traffic but won't people get offended or annoyed with every new thread being tweeted?

On a busy forum they certainly could. I use Digsby and always have a window open showing nothing but new threads on the forum, but not everyone is savvy enough to use filters like that.

sticky 04-12-2010 10:24 PM

Quote:

Originally Posted by Videx (Post 2020192)
On a busy forum they certainly could. I use Digsby and always have a window open showing nothing but new threads on the forum, but not everyone is savvy enough to use filters like that.

I see, so is there something that can allow to pick and choose which threads to tweet by clicking a button instead of doing it manually?

Videx 04-12-2010 10:57 PM

Quote:

Originally Posted by sticky (Post 2020195)
I see, so is there something that can allow to pick and choose which threads to tweet by clicking a button instead of doing it manually?

Who the heck would have the time to sit and do that in a timely fashion? Especially on a busy board. More realistically, just limit tweeting to exclude your busiest forums. But there's nothing stopping you from manually tweeting if you really want to go that route.

Jabong82 04-12-2010 11:00 PM

Anyone else have a separate Twitter account?

I just use this for SEO and have a separate account that people can follow. So 1 account for your updates/followers and another just for this mod.

sticky 04-12-2010 11:04 PM

Quote:

Originally Posted by Videx (Post 2020209)
Who the heck would have the time to sit and do that in a timely fashion? Especially on a busy board. More realistically, just limit tweeting to exclude your busiest forums. But there's nothing stopping you from manually tweeting if you really want to go that route.

I know, but what I was hoping is simply a tweet button next to where it says quote which would tweet the thread using a url shortener. Simple... I don't want to spam my followers with every thread.

sticky 04-12-2010 11:05 PM

Quote:

Originally Posted by Jabong82 (Post 2020210)
Anyone else have a separate Twitter account?

I just use this for SEO and have a separate account that people can follow. So 1 account for your updates/followers and another just for this mod.

I see, two accounts would work but if there are no followers what is the point?

Jabong82 04-12-2010 11:32 PM

Quote:

Originally Posted by sticky (Post 2020212)
I see, two accounts would work but if there are no followers what is the point?

Well if you have your posts tweeted, they create outside links to your site, which is one of the most important factors in search engine optimization (ie. ranking higher on google).

So yah no one would see it because you'd have no followers on that account, but in theory your search engine rankings should improve which is good for your overall site traffic.

LifesGreatestGift 04-13-2010 07:42 AM

Thanks for the fix!

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

Works perfect now! No more bit.ly or twitter php issues.

zelnik 04-14-2010 09:47 AM

Installed and working great first time!

Thanks a million!

zelnik 04-14-2010 03:35 PM

Just noticed that my RSS feeds are not being directed to Twitter?!?!

Noticed a lot of people saying the same.. I wouldn't mind making a small finanical donation if you could get RSS posts to be posted on Twitter?!

I'm sure others would also.

osayidan 04-15-2010 04:09 PM

is bit.ly having issues? I can not seem to register...
"There was a problem posting your request. Please try again."

Been trying for quite some time now.

edit: never mind, that was disgusting... i couldn't sign up with FF 3.6, loaded up my old IE 6 and it worked...

Chicken Racer 04-16-2010 01:10 PM

Quote:

Originally Posted by zelnik (Post 2021205)
Just noticed that my RSS feeds are not being directed to Twitter?!?!

Noticed a lot of people saying the same.. I wouldn't mind making a small finanical donation if you could get RSS posts to be posted on Twitter?!

I'm sure others would also.

Yes I 2nd that !

Videx 04-16-2010 02:49 PM

Why don't you just use Twitterfeed (or similar) to forward RSS to Twitter? Seems to me you're going to have trouble with any but the very shortest posts.

zelnik 04-16-2010 03:34 PM

Quote:

Originally Posted by Videx (Post 2022215)
Why don't you just use Twitterfeed (or similar) to forward RSS to Twitter? Seems to me you're going to have trouble with any but the very shortest posts.

I'm not sure what the problem is with RSS feeds to twitter on vb4 as there are a couple of addons for vb3.8 which work very very well. :(

mmacrypt 04-17-2010 02:32 AM

Just installed, seems to be working great, thank you very much.

Gene Steinberg 04-17-2010 03:44 PM

This is very poorly designed. Why not just build a standard plugin with a traditional Admin CP interface to insert the relevant details for this linkage? As it stands, all I see is an amateurish hack. Does anyone know how to do this correctly?

Peace,
Gene

Xeon3D 04-20-2010 05:54 AM

I'm getting the word "Array" appended to the end of each message and no link to the thread as you can check here:

http://twitter.com/xeon3dinfo/

here's my plugin contents:

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(5,6);

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

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

    if (
$useBitly) {
      
// http://classes.verkoyen.eu/bitly
      
require_once 'bitly.php';
      
$bitly = new Bitly('realusernamehere''realAPIkeyhere');
      
$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('realusernamehere','realpasswordhere');
    
$twitter->updateStatus($tweet);



Videx 04-20-2010 01:10 PM

Quote:

Originally Posted by Xeon3D (Post 2024183)
I'm getting the word "Array" appended to the end of each message and no link to the thread as you can check here:

Your code seems fine, so I'd look to some prior code interfering with it. A mod, or a bad edit. Maybe even some bad HTML somewhere.

Xeon3D 04-20-2010 03:59 PM

Disabled all products i had running, still got the same effect, other than that, the forum is preety much what vbulletin provides...

gwerzal 04-20-2010 08:58 PM

Woop woop got it working

Was proper doin me head in but got it workin in the end an think it was my own fault it wasnt working

Thank you

great mod

Phil K?vin 04-22-2010 02:07 AM

I have a problem.
Quote:

Parse error: syntax error, unexpected '/' in /home/.../public_html/newthread.php(273) : eval()'d code on line 11

SABRSox 04-25-2010 02:48 AM

This plugin suddenly stopped working for me. I haven't changed anything to either the code or to my Twitter account. Thoughts?

Alecsmith 04-27-2010 05:33 PM

Working thanks :)

TandyServices 04-27-2010 07:08 PM

Works great so far but what about private forums?? Is there a way to shut it off on some forums??

zelnik 04-27-2010 08:23 PM

Quote:

Originally Posted by TandyServices (Post 2028244)
Works great so far but what about private forums?? Is there a way to shut it off on some forums??

read the install instructions carefully :)

"You also should make a list of the forumIds that are non-public as you will want to put these in the array provided.

i.e. if your admin forum is forumId = 7 and you also have a private forum for regular members which is forumid = 12, then you will want this:
$excludedForums = array(7, 12);"

TandyServices 04-27-2010 08:37 PM

Yea just found that and was coming back to repost how dumb I was for not reading.. LOL.. Sorry..

Bob_R 04-30-2010 02:31 AM

Quote:

Originally Posted by SABRSox (Post 2026833)
This plugin suddenly stopped working for me. I haven't changed anything to either the code or to my Twitter account. Thoughts?

Same here.


All times are GMT. The time now is 04:20 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.01919 seconds
  • Memory Usage 1,875KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (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