WP to Twitter Updated to OAuth

August 16, 2010

Topics: WordPress.

Well, it’s a day for updates. Today was (at one point) the deadline for Twitter to permanently disable Basic authentication. The date has now been extended to August 31st, but the difference isn’t really significant.

The one benefit which it will provide is a little extra time to debug the new OAuth version of WP to Twitter before it becomes the only working version.

There are a lot of complications surrounding the OAuth update — most of them unfortunate. For the first time since I began work on this plugin, I had to remove features. As far as I can tell, there’s no way to operate two separate user accounts with an OAuth authenticated application, for example. As a result, I’ve had to remove the ability to assign separate author accounts for Twitter posting. As development progresses, a way forward may show up — but for now, I just don’t really have another option.

My biggest request at this time: if you can, please decide you’re willing to use this version now, to provide me with feedback so it will work as well as it possibly can when all past versions cease to be functional.

There will be problems; I’m sure of it. I just hope to find them all soon enough.

105 Comments to “WP to Twitter Updated to OAuth”

  1. Obviously, answering every question individually is beyond what I can keep up with at the moment. Here are some general notes:

    1) Error: Call to undefined function curl_init()

    Yes, you need cURL support for this plugin to work at this time. This will not be altered soon.

    2) Fatal error: Class ‘OAuthSignatureMethod_HMAC_SHA1’

    This comes from installations which are using a different OAuth class from that required by the plugin. Inform your host that you need to be using an OAuth class which supports that option; either by disabling their default OAuth library or by updating it to a different version.

    3) Parse error: syntax error, unexpected T_STRING, exp. T_OLD_FUNCTION or T_FUNCTIONor T_VAR or ‘}’

    This error comes from PHP (Hypertext PreProcessing) 4 not recognizing the public or private directives in the Twitter OAuth class. You need to upgrade to PHP 5.

    4) Twitter is blocking your application

    I’m sorry about that, but there’s absolutely nothing I can do about it. This is one of the powers which Twitter wanted to gain from this change: they can shut down any individual application. If they decided they didn’t like yours, that’s something I am unable to help with.

    5) If in doubt about what URL (Uniform Resource Locator), Application Name, or Description you should be using, be aware that in general you should be referring to your own web site as the operating application. What you are essentially doing is registering your web site as a Twitter application.

    6) If you need to change your hosting server to PHP 5 you need to contact your host. I can’t help you with that.

    7) Blank page – I believe that this is the same as the other undefined function or various fatal errors, but on installations with error reporting disabled. If somebody can tell me otherwise, that would be great.

    8) Failure to post.

    First steps: check your settings and verify everything is set up as expected. If using individual author options, disable it. Second: verify that Twitter has not disabled your application. Third: try various options, including posting an edit, posting a new post, and the test cycle before contact me. Give me as much detail as you can before reporting an error. I will no longer respond to uninformative requests for help – I don’t have the time to ask everybody for the details of their issues.

    Thank you – I’m closing comments on all WP to Twitter related posts except for the Support thread.

  2. I’ve done my own Twitter App and enter all required Keys. When i click on “Connect to Twitter” following Error Message appears:

    Parse error: syntax error, unexpected T_STRING, exp. T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in twitterOAuth.php on line 18

  3. How do I switch my blog settings to php5?

  4. @Michelle B and for anyone else having trouble filling in the form – Here’s a quick screenshot of a sample application: http://bit.ly/b6kT0T

    @Omar Here’s what my application page looked like after filling out the form (with secret stuff blocked out): http://bit.ly/9tl6Id

  5. @Jeremy I have the same issue as Duerrbi, and don’t have a page that looks like the one in your screen grab.

  6. Question here, what URL (Uniform Resource Locator) am I supposed to be using? I’ve tried my Twitter and my blog address and it says it’s invalid. Any thoughts?

  7. I am getting the error:” OAuth Authentication Failed. Check your credentials and verify that Twitter is running.”

    I have checked and double checked the tokens. They look correct. Is there any log where I could see what the more specific problem is?

  8. hi,

    i tried creating an application for twitter tools, if it works the same way in your plugin also the sorry news is twitter is blocking most of the new applications created after a couple of days.

  9. i can’t activate the “curl_init” on my Webspace. Is that the only way how this plugin works? I would like to use it. But my provider allows me to not have this function.

  10. Is not working on mine!
    Fatal error: Class ‘OAuthSignatureMethod_HMAC_SHA1’ not found!

  11. @Duerrbi After finding your Consumer Key and Consumer Secret, click on the “My Access Token” link on the right side menu. Here’s a picture pointing it out: http://bit.ly/9MeNlK

  12. Hey Joe: I’m getting the same error that one of the Davids described: “Fatal error: Class ‘OAuthSignatureMethod_HMAC_SHA1’ not found in /home/server/public_html/wp-content/plugins/wp-to-twitter/twitterOAuth.php on line 61”. I’m using a shared hosting server. How might I go about describing the problem to my host?

  13. I’ve just updated to beta 4, configured everything, and when I hit on “check support”, the output is:
    “This plugin may not fully work in your server environment. The plugin failed to contact both a URL (Uniform Resource Locator) shortener API (Application Programming Interface) and the Twitter service API.”

    Everything was working fine before, my site runs on Apache, PHP (Hypertext PreProcessing) version 5.2.12.

  14. Dude, I found the problem.
    I use “Twit Connect” and probably it makes conflict with Wp-To-Twitter because both are using oauth.

  15. 3. Copy and paste your Access Token and Access Token Secret into the fields below

    On the right hand side of your application page, click on ‘My Access Token’.

    Access Token

    Access Token Secret

    I can’t find anything like an an access token string on my twitter’s application site

  16. Thank you!! Fixed 🙂

  17. In case everyone was wondering, Application Name: WP-to-

  18. Hi, Joe.
    I installed WordPress 3.0.1 and the host I’m using has PHP (Hypertext PreProcessing) 5.2.10

  19. Hey there,
    I just installed Version 2.2.0 (beta 4) (Word Press 3.0.1), and am still getting the blank page (with header and sidebar visible) when I attempt to connect to Twitter. I’ve tried testing the “Check Support” button, but I’m informed that I have not connected to Twitter.

    I went to the Twitter developer page and tried getting a new consumer key, but that didn’t help.

    Thanks Joe for all of your rapid support on this issue.

  20. Sorry, you can delete my comment. It was a prob with another plugin I updated at the same time. In this way, I think the beta4 works fine and publishs the tweets correctly, too.

  21. One more Problem: White Screen with the activated wp->twitter beta3 or beta4 plugin after publish or update a post. But all changes are saved in the database, post is published, etc. …
    I use WP 3.0.1 – all works fine since updating wp->twitter

  22. @Alf Thanks for that information – knowing that the problem is with the templates in specific, rather than with the tag replacement is an extremely valuable piece of information.

    @Miki If you need it to be functioning, feel free to downgrade to 2.1.3 and wait for more bugs to be worked out in this version.

    @Crystal It looks like you need to upgrade to PHP (Hypertext PreProcessing) 5. Your hosting service should have a mechanism to enable this, or you can contact their support services.

    @Bryan I’m not sure why that contributor’s post wouldn’t have posted, but I’ll look into that.

  23. Follow-Up: Updates work fine too, if I manually fill in the twitter message field or use the approbiate tags in there. If I trust on the config ( Edit: #title# – #post# #url# ) only the hashtags are shown.

  24. For new Blogposts everthing works fine. But for Updates, the Tweets only contain the hashtags. No Post-Title, Abstract or Post-Url as configured. That worked fine in previous versions.

  25. Having the same problem as Markus. Updated, use correct keys, everything. Nothing posts to Twitter! Any suggestions? I’ve tried all I know how to do. Was working fine until all these updates.

  26. @Joe Dolson no worries about the support 🙂 glad you made this plugin, its very useful.

  27. Joe,

    I updated to the beta 3 release (from beta 1) a little while ago. It published to Twitter as expected. However, I still have one thing I need to check on. Prior to updating, there was a contributor’s post pending publish. I published that post after updating, however it was not posted to Twitter. It may simply be because it was there prior to updating the plugin. Will have to see what happens the next time we publish a contributors post.

    Thanks for your wonderful plugin. We are using it on both AppleRelated.com and TalkAndroid.com. 🙂

    Bryan

  28. Apparently what I thought was a posting error with the test message wasn’t. I followed Joe’s set-up instructions, updated to the latest beta, and the tweet went through immediately after publishing a blog post, and it had the correct bit.ly link in the tweet.

    Thanks again Joe.

    John

  29. oh i’m on the latest WP version.

  30. I followed the instructions and get this error in WP:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/aphon0/public_html/my-makeup/wp-content/plugins/wp-to-twitter/twitterOAuth.php on line 18

  31. Hello Joe,

    I use the current Beta 3 version and have entered the correct Twitter Keys. Unfortunately still no posts will be transferred to Twitter. Do you have an idea?

    Thank you!

    Markus

  32. @Michael Well, that proves that the connection is active and functioning — it’s just the cycle that handles posting which isn’t working. Let me think about it a bit…

  33. Joe,
    I found it and changed the blank to “yes” tried another update, no go.
    I checked my Twitter page, and found this:

    Tweet
    Latest: This is a test of WP to Twitter. (6096968) 37 minutes agoLatest: This is a test of WP to Twitter. (6096968) 37 minutes ago from @yurself

    Maybe we are making some progress?

    Thanks,
    Michael

  34. @Michael It’s a custom field for your posts; it should be viewable in the custom fields area below the main post field on the admin pages to create a new post or edit your posts. It is not part of the WP to Twitter set up. If it’s not found at all on your posting or editing pages, that’s also fine – it’s programmatically equivalent to having a blank value.

  35. Joe
    Thanks for the quick response. In my basic settings, advanced settings or post page for WP there is no such animal as “jd_tweet_this” In my basic settings I have all the options checked. In the advanced settings I only have “update Twitter when a post is published using Quickpress” 2 blogs now updated with Oauth consumer and access tokens no updates to Twitter published.

    I have seen the “jd_tweet_this in previous iterations of WP->Twitter but now I do not. Where would I be looking for this property?
    Thanks,
    Michael

  36. It’s now working. The existing set up DIDN’T like being edited. I had to delete the application in dev.twitter and then start again.

    It then worked!

  37. @kev Must be set to read and write. I’m fairly certain that this is in the setup instructions with the plug-in; if it’s not, I must have somehow overwritten that at some point. (You can’t post to Twitter if you only have reading permissions!)

  38. Joe should dev.twitter be set to read and write or just read?

  39. @kev It’s worth a try. Check them carefully! Be sure to check for any extra spaces before or after (I should be trimming white space off; but I’m not sure that I actually am in that version.)

  40. Should I try disconnecting and reconnecting to twitter in the settings?

  41. @kev No, unfortunately. I’ll keep exploring independently.

    @Michael No, that’s not what should be happening. Have you verified that your settings match your expectation? In order for an edited post to be posted, the following conditions need to be met: 1) The basic option to post edits must be checked 2) The value of the custom field ‘jd_tweet_this’ must either be ‘yes’ or blank. If you can verify that for me, it would be appreciated.

    @Jorgicio That’s a new one. My guess is that your installation is including a different version of OAuth or TwitterOAuth which doesn’t include that method, but that really doesn’t make any sense, given that the get method is rather key to any use of OAuth. What versions of PHP (Hypertext PreProcessing)/WP are you running?

  42. It’s working thank you!

  43. Any idea Joe from the export I sent you?

  44. So I followed the update procedure. (By the way in your instructions the “application name website” would have been helpful) I then tested it with three different posts which have been previously posted. None of them showed up on twitter! Does this mean there is only one tweet per post and never an update to a post? If so there is no point for using this.
    Thanks,
    Michael

  45. Hi.
    I upgraded the version of Wp-To-Twitter with OAuth Support. I created the Twitter Application and when I configure, I got this error:

    Fatal error: Call to undefined method TwitterOAuth::get() in /home/a1986870/public_html/wp-content/plugins/wp-to-twitter/wp-to-twitter-oauth.php on line 55

    Thanks.

  46. I am being really thick now – where is the export option? 🙁

  47. I don’t doubt it is something stupid Joe, but yeah I’d appreciated you looking at it. I’ll send it shortly.

  48. @Alf Thanks – glad to hear it.

    @kev I don’t know. With Beta 3 everything should generally work, although I can’t eliminate every possibility. Can you send me your plug-in’s settings export? That may help me debug your issue. The fact that the plug-in worked before has no bearing; there are no common elements between the previous authentication methods and OAuth.

  49. Since Beta3 everthing is fine again, thanks a lot!

    I had the same probs as James and kev: no tweets and the “contact both a URL (Uniform Resource Locator) shortener API (Application Programming Interface) and the Twitter service API.”-Error. Now the tweets came all at once.

  50. Ok thank makes sense Joe, so why am I getting that error. This plug in worked perfectly before.

  51. @kev The OAuth process is the entirety of your authentication with Twitter. Once you’ve added the four keys required in the OAuth setup, you’re done. Your username and password are not required. OAuth is a data exchange format which is used in place of your login and password to access Twitter.

    @Beregond Thanks for noting this.

  52. When using cli.gs I get an error message that my URL (Uniform Resource Locator) was not shortened. A bit.ly URL appears that goes to my 404 page. This happens both with and without a cli.gs API (Application Programming Interface) key.

  53. No it is blank. There used to be a username and password for my twitter account, but I can’t find that now.

    This is what I am trying to understand mate, am I in effect using WP-Twiiter to log onto AOuth and that then forwards the details to my twitter account?

    If so do I put the AOuth log on details in:

    Add Twitter-compatible Service

    URI (Uniform Resource Identifier) for Twitter-compatible Post Status API (Application Programming Interface)

    Service Name

    Status Update Character Limit

    Post status updates to both Twitter and this service.

    Your service username:

    Your service password:

  54. @kev Have you put information in the Twitter compatible service area? If that area is filled in, it will be used in place of Twitter; if you’ve used it in the past, you’ll need to remove it.

  55. Right, sorry I’m a little unsure of what is happening here.

    I understand that authentication is being done through OAuth, which I’ve added the details in – but I am getting the error message I previously indicated. What has happened?

    Is this because the mod is no longer directly tweeting and it is going through OAuth?

  56. @kev Only if you’re using a second service to post to; the twitter-compatible service can not be used with Twitter.

  57. I’m confused, do I have to re-enter my twitter details in the section “Add Twitter-compatible Service?”

  58. Ok upgraded, I have progress. It hasn’t tweeted but has errored which it didn’t before:

    One or more of your last posts has failed to send it’s status update to Twitter. Your Tweet has been saved in your post custom fields, and you can re-Tweet it at your leisure.

    Sorry! I couldn’t get in touch with the Twitter servers to post your new blog post. Your tweet has been stored in a custom field attached to the post, so you can Tweet it manually if you wish!

  59. @kev You need to upgrade to beta 3. It may not be viewable in your Dashboard yet.

  60. @Tom That’s great –

    For everybody: upgrading your server to PHP (Hypertext PreProcessing) 5 is a highly recommended choice. I will not be supporting PHP 4 in this or future versions of WP to Twitter. WordPress itself will discontinue support for PHP 4 soon.

  61. Joe, I have Version 2.2.0 (beta 2)installed but still not tweeting posts.

  62. @Melanie I’ll contact you separately and see what’s up.

    @Mandy Yes, I don’t recommend that people who aren’t prepared to work through these bugs upgrade to a beta version.

    @Rob Thank you!

  63. i had the same problem as Shaun and Mike S, updating my server to PHP5 fixed everything!

  64. Joe—Thanks for working quickly and for continuing work on this plugin!

  65. “This version should solve most issues with failing to post to Twitter.”

    @Joe Thanks for all your efforts 🙂

    I found an old copy of WP to Twitter and reloaded that until the bugs are ironed out.

  66. I upgraded to the new version. I’ve done everything right and it’s still not working. 🙁

  67. Yo!
    Thank You @Joe, this second update seems to work fine!

    I’ve just seen my post twitted on my stream (with my callback url, etctera etcetera).

    I’ve some blog with your plugin, so i’m working for this oAuth thing, developing apps and so on…

    Thank you!

  68. When will this new version show up in our WP dashboards as an update?

  69. I posted the previous version because I wanted to eliminate unnecessary problem reports while I worked on the failing to post issue; thankfully, it proved to be very simple, and has been solved. New version has just been posted (I think that’s the fastest time between versions I’ve ever hit…)

    This version should solve most issues with failing to post to Twitter.

  70. Updated but still not delivering to Twitter – although check support button not delivering “server environment” message above.

  71. @David That’s the result of a PECL class installed with PHP (Hypertext PreProcessing) with includes a different version of the OAuth library. Because that’s installed, the copy included with the plugin is not being used. You’ll need to talk to your host about getting that disabled.

  72. I just updated but posts still not being tweeted.

  73. No, it’s likely that the new version won’t change anything about what actually posts to Twitter; it’ll only deal with the false error messages. This is more to make my life easier by reducing the number of people reporting problems which aren’t really problems.

  74. Please, anyone knows why I get this message at pushing ‘Connect to twitter’?

    Fatal error: Class ‘OAuthSignatureMethod_HMAC_SHA1’

  75. I get the same message as James. My posts don’t publish to Twitter. Does this mean the NEW new version will fix this?

  76. @james Literally, this means “the test routine wasn’t updated to reflect the changed return values in the twitter posting routine.” In otherwords; nothing.

    New version has just been posted; resolves minor issues such as this.

  77. This plugin may not fully work in your server environment. The plugin failed to “contact both a URL (Uniform Resource Locator) shortener API (Application Programming Interface) and the Twitter service API.” So this means what?

    Thanks

  78. @David Thanks for helping me support this. I appreciate that.

    @others It seems to me like there are four basic problems being encountered: 1) syntax errors, 2) blank screen on OAuth connect, 3) curl_init doesn’t exist and 4) Posting to Twitter doesn’t work.

    The first is a PHP (Hypertext PreProcessing) version issue; WP to Twitter required PHP 5 as of this version. You’ll need to upgrade to PHP 5. The second is unknown; but I’ve made a change and I’ll see if it fixes it. The 3rd is also a server support issue — the twitterOAuth library requires cURL to be installed. At a later date I may rewrite that library, but not soon.

    The fourth item is the one I’m most concerned about. I’ll be contacting you separately to try and isolate the issues. Thank you.

  79. Update.

    I deleted my twitter app and redid it. With the same exact settings. This time it worked … Twitter Flakey? No way!

  80. @ Melvin:

    Thanks, wasn’t sure. That got it going for me. We’ll see if it tweets now.

  81. I wonder if this is the plugin or twitter. Here’s why.

    I have updated this plugin on two of my sites. Same backend, same frontend, same plugins, alike in most ways. I logged into site A’s twitter account and set everything up. No problem, test tweets are fine. I logged into site B’s twitter account and set up the dev work. This time, problem. I can’t get past “This plugin may not fully work… ” no matter what I try. All configurations are the same. I’ve uninstalled, reinstalled, deleted my app, revoked permissions, …

    I’ll keep trying.

  82. @Sarah
    Just chose a different name! ^^

  83. My problem is more annoying. Twitter says that “Twitter cannot be the name of my app,” so the title doesn’t work. I don’t know what to put for the description or website address of the app and Twitter says those fields are mandatory.

  84. Chris, it did mention it was a beta though.
    Most twitter plugins are updating to this new autho mechanism, so you will have problems will all of the other plugins, either now or afterwards, cause everyone is being forced into switching to it.

  85. This beta should never have been distributed via the update function! I get the same error:
    Fatal error: Call to undefined function curl_init () in /xxx/xxx/xxx/xxx/xxx/wp-content/plugins/wp-to-twitter/twitterOAuth.php on line 201

  86. Shaun, look at my last post.

  87. Mike.S I had the same problem, but it had to do with the version of PHP (Hypertext PreProcessing) being used.

    I used to use another twitter app (twitter tools) and it had the same problem, one of the reasons why I switched to WP2twitter.
    The beta uses libraries that PHP4 doesnt support, thats the reason why you are getting the problem, if your hosting company has a PHP Switch then I suggest you use it to switch to PHP5.

    Hope this resolves the problem for others.

  88. I am getting this error and have no clue of how to fix the problem:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /usr3/home/blue-gecko.com/htdocs/cisdiveteam/wp-content/plugins/wp-to-twitter/twitterOAuth.php on line 19

    Can someone help me?

  89. Same as above

    After doing the update Wp-Twitter doesn’t tweet any updates. I’ve had to do it manually. I followed the instructions and have connected correctly like everyone else.

  90. Yep same for me, after doing the update Wp-Twitter doesn’t tweet any updates. I’ve had to do it manually.

    I followed the instructions and have connected correctly like everyone else.

  91. First of all, I have to say my host have PHP5 support, but when I follow all steps for OAuth and I push ‘Connect Twitter’… I got this error msg.

    Fatal error: Class ‘OAuthSignatureMethod_HMAC_SHA1’ not found

    Anyone who has solved it?

  92. I get the following message

    Fatal error: Call to undefined function curl_init() in /var/www/XXXXXX/html/XXXXXX/wp-content/plugins/wp-to-twitter/twitterOAuth.php on line 201

  93. I too am having the same problem with this message: This plugin may not fully work in your server environment. The plugin failed to contact both a URL (Uniform Resource Locator) shortener API (Application Programming Interface) and the Twitter service API.

    Unfortunately before the change (which I was forced to do after having to disable all plugins and re-enable them), it worked great. Now, it doesn’t work at all.

  94. Same problem as John. Does anyone have a clue yet?

  95. Same problem as John.

  96. I’m having the problem that Rob described” after I enter all of the information from the Twitter developer page, I select “connect to Twitter” and it doesn’t connect. Instead I get a blank page with the standard Word Press banner and sidebar, with the warning about OAuth at the top.

    I tried opening and saving twitterOAuth.php as Rob suggested, but I’m informed that I don’t have sufficient permission to do so even though I’m an admin.

    Thoughts?

  97. By the way, this is what the test tweet is looking like:

    This is a test of WP to Twitter. (5579921)

  98. Just tried it with cli.gs also and had the same result.

  99. Went through the set-up procedures and everything seemed to work, Twitter acknowledges the new application, but when I click on the “Check Support” button I get a message that says, “This plugin may not fully work in your server environment. The plugin failed to contact both a URL (Uniform Resource Locator) shortener API (Application Programming Interface) and the Twitter service API.”

    bit.ly and WP to Twitter were previously working fine in this server environment, so not sure what’s happening.

    Thanks for a great plug-in.

  100. Update: Seeing Mike’s comment, I sniffed around in twitterOAuth.php. I saved the file (after changing a bracket, then undoing that change) and now it’s connected.

    So—simply open twitterOAuth.php and save the file again if you get no feedback after trying to connect with Twitter.

  101. I have completed soebend the update.

    The following problem occurs. The url is not delivered to Bit.ly. There appears not. Also not a tweet to Twitter itself is delivered.

    From ‘WP to Twitter’ is no error message!

    Silvio

  102. I registered for an OAuth account. When I fill in the keys, and submit”Connect to Twitter”), I get an error message, stating:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /usr3/home/blue-gecko.com/htdocs/cisdiveteam/wp-content/plugins/wp-to-twitter/twitterOAuth.php on line 19

    I downloaded / upgraded through WP. The keys get saved (data is there if I return to the page), but will not process.

  103. I get a blank area on the page after submitting the oAuth info and it’s seemingly not saving the data as it keeps telling me to change the settings…