phil-lavin / Wordpress-Twitter-Blog

Plugin based on http://wordpress.org/extend/plugins/twitter-blog/. Many bug fixes and new features.
http://phil.lavin.me.uk/
1 stars 0 forks source link

new blog posts random propogate as tweets #9

Open netllama opened 12 years ago

netllama commented 12 years ago

I recently switched from Chris Mielke's version of this plugin to this new one, in the hopes that it would fix a long standing bug. Sadly, it hasn't. What I see if that whenever I create a new blog post, its a completely random crapshoot on whether the post will generate a tweet (via the plugin). Just a few minutes ago, I created 4 new blog posts, and two of them generated tweets, the other two seemingly ended up lost to /dev/null.

The fact that this works some times, yet not others suggests that I must have the plugin setup correctly, or it wouldn't ever work. I'm not at all sure how to debug this, but I'm willing to try whatever is suggested.

thanks!

phil-lavin commented 12 years ago

Hummm - the original had many bugs but this isn't one I saw. I can only think it's conflicting with another plugin. You could try disabling all other plugins and see if you can replicate the issue. If you can't, then try selectively disabling plugins until you find the offending one.

netllama commented 12 years ago

Unfortunately, your plugin is the only one that I have active, so unless disabled plugins can cause this, its not due to them.

Is there some way to enable extra debugging to determine what's going wrong when it fails?

phil-lavin commented 12 years ago

Might be that you're exceeding Twitter API limits. Do you use the oAuth token anywhere else?

netllama commented 12 years ago

Yes, I do use the token in other places, although I haven't noticed any issues with it elsewhere. Is there some way for me to instrument the plugin to determine if I am really exceeding the API quotas?

phil-lavin commented 12 years ago

Best bet would be to log inside the twitteroauth.php. Just above line 231 (return $response;) put the following code:

$handle = fopen('/path/to/writable/file', 'a');
fwrite($handle, "--".date('r')."--\n".$response."\n\n\n");
fclose($handle);

Naturally, change /path/to/writable/file to the path of a file that has write permissions on it. This file will collect the logs.

Following this, submit a few posts until it fails to Tweet and put the log here. I'd check the log after each submission (successful or otherwise) to ensure data has gone into it. If it's the case that when it fails to Tweet, nothing goes into the log (assuming you've gotten the code writing to the log on success), it's likely it's failing before Twitter; Perhaps on the bitly call.

phil-lavin commented 12 years ago

Sorry, there were a few typoes in the code. Corrected above - make sure you use this rather than the one github would have e-mailed as it'd be c/w typos.

netllama commented 12 years ago

I made the changes you noted two comments up, but the log that I'm writing to remains empty after creating new posts. So this likely means that the failure is happening earlier in the process?

phil-lavin commented 12 years ago

Have you gotten it writing to the log properly on success?

netllama commented 12 years ago

Unfortunately, even after 10 new posts, none of them made it to twitter, so the success rate seems to be rather low. I guess I could keep creating dummy posts until something hits twitter, but this seems like an inefficient way to debug this.

phil-lavin commented 12 years ago

Under line 208 of twitter-blog.php... the one that starts $status = (strlen($status)

Put this:

die($status);

Then post here what is displayed on screen when you post.

netllama commented 12 years ago

This is quite bizarre. Nothing is displayed. Its as if the plugin isn't being invoked at all, even though I'm certain that its enabled & fully configured.

netllama commented 12 years ago

I just noticed that the log does have content in it, although I can't quite figure out how any of this is related to what I was posting in the blog:

--Sat, 14 Jul 2012 17:26:34 +0000-- {"id":766569,"statuses_count":3137,"profile_background_image_url_https":"https:\/\ /si0.twimg.com\/profile_background_images\/592117070\/nc9x7khavsj1j25z77vy.jpeg"," default_profile_image":false,"favourites_count":0,"profile_background_image_url":" http:\/\/a0.twimg.com\/profile_background_images\/592117070\/nc9x7khavsj1j25z77vy. jpeg","following":true,"profile_link_color":"ff7000","utc_offset":-28800,"name":"L onni J Friedman","notifications":false,"profile_use_background_image":true,"contri butors_enabled":false,"geo_enabled":false,"protected":false,"profile_text_color":" 000000","id_str":"766569","default_profile":false,"profile_image_url":"http:\/\/a0 .twimg.com\/profile_images\/53339898\/llama_normal.gif","show_all_inline_media":tr ue,"followers_count":98,"profile_sidebar_border_color":"b4c0a5","description":"Ran ting & raving about Linux, travel, and life in general","url":"https:\/\/netllama. linux-sxs.org","screen_name":"netllama","profile_background_tile":false,"created_a t":"Mon Feb 12 05:47:31 +0000 2007","listed_count":5,"friends_count":131,"lang":"e n","profile_sidebar_fill_color":"473b38","verified":false,"time_zone":"Pacific Tim e (US & Canada)","status":{"in_reply_to_user_id_str":null,"id_str":"22416005315284 1730","in_reply_to_screen_name":null,"in_reply_to_user_id":null,"in_reply_to_statu s_id":null,"retweeted":false,"retweet_count":0,"truncated":false,"created_at":"Sat Jul 14 15:14:56 +0000 2012","coordinates":null,"geo":null,"place":null,"favorited ":false,"source":"\u003Ca href=\"https:\/\/netllama.linux-sxs.org\" rel=\"nofollow \"\u003Enetllamabti\u003C\/a\u003E","in_reply_to_status_id_str":null,"contributors ":null,"id":224160053152841730,"text":"why are there hundreds of HOWTOs for import ing from Flickr to Google+, but nothing for going the other way? sigh #FAIL"}," is_translator":false,"location":"Silicon Valley, California","profile_image_url_ht tps":"https:\/\/si0.twimg.com\/profile_images\/53339898\/llama_normal.gif","profil e_background_color":"000000","follow_request_sent":false}

--Sat, 14 Jul 2012 17:26:40 +0000-- {"id":766569,"statuses_count":3137,"profile_background_image_url_https":"https:\/\ /si0.twimg.com\/profile_background_images\/592117070\/nc9x7khavsj1j25z77vy.jpeg"," default_profile_image":false,"favourites_count":0,"profile_background_image_url":" http:\/\/a0.twimg.com\/profile_background_images\/592117070\/nc9x7khavsj1j25z77vy. jpeg","following":true,"profile_link_color":"ff7000","utc_offset":-28800,"name":"L onni J Friedman","notifications":false,"profile_use_background_image":true,"contri butors_enabled":false,"geo_enabled":false,"protected":false,"profile_text_color":" 000000","id_str":"766569","default_profile":false,"profile_image_url":"http:\/\/a0 .twimg.com\/profile_images\/53339898\/llama_normal.gif","show_all_inline_media":tr ue,"followers_count":98,"profile_sidebar_border_color":"b4c0a5","description":"Ran ting & raving about Linux, travel, and life in general","url":"https:\/\/netllama. linux-sxs.org","screen_name":"netllama","profile_background_tile":false,"created_a t":"Mon Feb 12 05:47:31 +0000 2007","listed_count":5,"friends_count":131,"lang":"e n","profile_sidebar_fill_color":"473b38","verified":false,"time_zone":"Pacific Tim e (US & Canada)","status":{"in_reply_to_user_id_str":null,"id_str":"22416005315284 1730","in_reply_to_screen_name":null,"in_reply_to_user_id":null,"in_reply_to_statu s_id":null,"retweeted":false,"retweet_count":0,"truncated":false,"created_at":"Sat Jul 14 15:14:56 +0000 2012","coordinates":null,"geo":null,"place":null,"favorited ":false,"source":"\u003Ca href=\"https:\/\/netllama.linux-sxs.org\" rel=\"nofollow \"\u003Enetllamabti\u003C\/a\u003E","in_reply_to_status_id_str":null,"contributors ":null,"id":224160053152841730,"text":"why are there hundreds of HOWTOs for import ing from Flickr to Google+, but nothing for going the other way? sigh #FAIL"}," is_translator":false,"location":"Silicon Valley, California","profile_image_url_ht tps":"https:\/\/si0.twimg.com\/profile_images\/53339898\/llama_normal.gif","profil e_background_color":"000000","follow_request_sent":false}

netllama commented 12 years ago

No other suggestions?