wordpress to twitter plugin error
Scenario:
I upgrade one of my wordpress plugin “WP to Twitter” to latest version (Version 2.2.0) for the OAuth and found that it doesn’t work with my hosting plan (hostgator).
When I click on the “Connect to Twitter” and there is a fatal error “Fatal error: Class ‘OAuthSignatureMethod_HMAC_SHA1’ not found.”
After performing some debugging and found that it is due to OAuth enabled in my hostgator PHP.
In hostgator, they are using PHP 5.2.14 with OAuth enabled. This is the main reason causing the problem.
Inside the PHP OAuth, it contain of a set of classes (OAuthException is one of them) and “WP to Twitter” plugin is using this class to perform some checking and causing the problem.
Solution:
Here is the modification that I done for my wordpress plugin.
<?php // vim: foldmethod=marker // remove the checking on class OAuthException and add in for OAuthConsumer // if (!class_exists('OAuthException')) { if (!class_exists('OAuthConsumer')) { // Comment the OAuthException class /* Generic exception class */ //class OAuthException extends Exception { // pass //} class OAuthConsumer { public $key; public $secret; function __construct($key, $secret, $callback_url=NULL) { $this->key = $key; $this->secret = $secret; $this->callback_url = $callback_url; } function __toString() { return "OAuthConsumer[key=$this->key,secret=$this->secret]"; } } //more codes below |
6 Comments to “wordpress to twitter plugin error”
Leave a Reply
I was looking for exactly this, thanks for the help. A short addendum however: you also need to comment out the last right curly bracket at the end of the file (with version 2.2.1 at least).
Hi, Thanks very much it just resolved the same issue today !
Thank you very much for the solution to get rid of this horrible error!
You are welcome!!!
dude…. thank you so freaking much!!!
i’ve been reading every single line of the “twitter tools” plugin for wordpress.
i couldn’t find the bloody problem….
your solution just fixed it all!
i could kiss you!
thanks for posting this for everybody to read.
Thanks. Works great.