WordPress.org

Ready to get started?Download WordPress

Forums

Twitter for WordPress
[Plugin: Twitter for WordPress] Fix for Twitter Feed URL Error (code 34) since early Oct2012 (22 posts)

  1. pantaluna
    Member
    Posted 1 year ago #

    Hi,
    Have you also noticed that the Twitter messages are no longer displayed by this WordPress plugin?

    The reason for this is that the URL to get the RSS Feed of your Twitter Messages has been changed by Twitter early October 2012.
    Old Call: http://twitter.com/statuses/user_timeline/myusername.rss
    New Call: http://api.twitter.com/1/statuses/user_timeline/myusername.rss

    I have updated the plugin to reflect that change in the Twitter API for RSS Feeds.
    Download it here, the author can integrate it in the official version of the plugin if he wants to.

    https://dl.dropbox.com/u/5629939/twitter-api-fix-oct2012.zip

    You can see the Twitter widget in action at the top of the sidebar at http://www.feestdagen-belgie.be/

    Good Luck,
    Rolf.

    http://wordpress.org/extend/plugins/twitter-for-wordpress/

  2. immanence
    Member
    Posted 1 year ago #

    I noticed my Twitter feeds go down globally across my domains sometime around 10-11 October. I looked at the time but could find no posts or blogs referring to this, so my host lost a week trying to figure out if the problem was server related. Thanks Twitter.

    Thanks for this post. It gives me a clue as to what to look for in the code of my affected domains.

    Boo to Twitter for not at least announcing this change and the affect it might have on WordPress sites.

  3. tallhat
    Member
    Posted 1 year ago #

    I also had several WP sites using this plugin affected by this API issue. To be fair to Twitter they have been announcing this change for many months, probably the best part of a year. But if you're not on a Twitter developer list of some sort the announcements may not have been seen.

    the main issue was actually that this plugin in no longer supported and hasn't been updated for 2 years (not Twitter's fault!).

    I've actually switched my themes to use newer Tweet integration plugins which are more actively developed (so hopefully less chance of this happening again in the future if the API gets changed again!)

    Thank's to pantaluna above for the patch, but if you have the opportunity it might be better to bite the bullet and switch plugins to a more recent active one.

  4. immanence
    Member
    Posted 1 year ago #

    I just want to add that while I'm responding to this thread, I wasn't using this plugin. The Twitter API change affected my themes that had Twitter feed integration as one of their featured widgets or shortcodes.

  5. tallhat
    Member
    Posted 1 year ago #

    sure, i also have had the same. basically you need to be looking for the code in your widgets/plugins/shortcodes that looks something like this:

    http://twitter.com/statuses/user_timeline/username.json
    ?callback=twitterCallback2&count=5

    that's the old API method.

    it needs to be changed to something like:

    http://api.twitter.com/1/statuses/
    user_timeline.json?screen_name=username&include_rts=true
    &count=5&callback=twitterCallback2

    see also:
    http://support.designerthemes.com/forum/topic/1832/twitter-feed-stopped-working

  6. leonelcamara-iam
    Member
    Posted 1 year ago #

    I fixed this by changing the function twitter_messages in the plugin to:

    function twitter_messages($username = '', $num = 1, $list = false, $update = true, $linked  = '#', $hyperlinks = true, $twitter_users = true, $encode_utf8 = false) {
    
    	global $twitter_options;
    	include_once(ABSPATH . WPINC . '/rss.php');
    
    	$rss= fetch_feed('http://api.twitter.com/1/statuses/user_timeline/'.$username.'.rss');
    
    	if ($list) echo '<ul class="twitter">';
    
    	if ($username == '') {
    		if ($list) echo '<li>';
    		echo 'RSS not configured';
    		if ($list) echo '</li>';
    	} else {
    			if ( is_wp_error($rss) ) {
    						if ($list) echo '<li>';
    						echo 'error retrieving feed';
    						if ($list) echo '</li>';
    			} else {
    				$messages = $rss->get_items(0, $num);
    
    				foreach ($messages as $message ) {
    					$msg = " ".substr(strstr($message->get_description(),': '), 2, strlen($message->get_description()))." ";
    
    					if($encode_utf8) {
    						$msg = utf8_encode($msg);
    					}
    					$link = $message->get_permalink();
    					if ($list)
    						echo '<li class="twitter-item">';
    					elseif ($num != 1)
    						echo '<p class="twitter-message">';
    		          	if ($hyperlinks) {
    		          		$msg = hyperlinks($msg);
    		          	}
    		          	if ($twitter_users)  {
    		          		$msg = twitter_users($msg);
    		          	}
    					if ($linked != '' || $linked != false) {
    			            if($linked == 'all')  {
    			            	$msg = '<a href="'.$link.'" class="twitter-link">'.$msg.'</a>';  // Puts a link to the status of each tweet
    			            } else {
    			            	$msg = $msg . '<a href="'.$link.'" class="twitter-link">'.$linked.'</a>'; // Puts a link to the status of each tweet
    			            }
    		          	}
    		        	echo $msg;
    		        	if($update) {
    		        	    $time = strtotime($message['pubdate']);
    		        	    if ( ( abs( time() - $time) ) < 86400 ) {
    		        	        $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
    		        		}
    		        	    else {
    		        	        $h_time = date(__('Y/m/d'), $time);
    		        	    }
    		        	    echo sprintf( __('%s', 'twitter-for-wordpress'),' <span class="twitter-timestamp"><abbr title="' . date(__('Y/m/d H:i:s'), $time) . '">' . $h_time . '</abbr></span>' );
    		        	}
    					if ($list) echo '</li>'; elseif ($num != 1) echo '</p>';
    				} /* end foreach*/
    			} /* close else */
    		}
    		if ($list) echo '</ul>';
    }

    I took the chance to fix the problem of it using a deprecated wordpress function by also changing the plugin to use fetch_feed

  7. phenomblue
    Member
    Posted 1 year ago #

    Thanks leonelcamara-iam, that was very helpful! You forgot to update $message['pubdate'] to $message->get_date() though so it was throwing an error if the $update flag was enabled. Here's a version with that fix:

    function twitter_messages($username = '', $num = 1, $list = false, $update = true, $linked  = '#', $hyperlinks = true, $twitter_users = true, $encode_utf8 = false) {
    
    	global $twitter_options;
    	include_once(ABSPATH . WPINC . '/rss.php');
    
    	$rss= fetch_feed('http://api.twitter.com/1/statuses/user_timeline/'.$username.'.rss');
    
    	if ($list) echo '<ul class="twitter">';
    
    	if ($username == '') {
    		if ($list) echo '<li>';
    		echo 'RSS not configured';
    		if ($list) echo '</li>';
    	} else {
    			if ( is_wp_error($rss) ) {
    						if ($list) echo '<li>';
    						echo 'No public Twitter messages';
    						if ($list) echo '</li>';
    			} else {
    				$messages = $rss->get_items(0, $num);
    
    				foreach ($messages as $message ) {
    					$msg = " ".substr(strstr($message->get_description(),': '), 2, strlen($message->get_description()))." ";
    
    					if($encode_utf8) {
    						$msg = utf8_encode($msg);
    					}
    					$link = $message->get_permalink();
    					if ($list)
    						echo '<li class="twitter-item">';
    					elseif ($num != 1)
    						echo '<p class="twitter-message">';
    		          	if ($hyperlinks) {
    		          		$msg = hyperlinks($msg);
    		          	}
    		          	if ($twitter_users)  {
    		          		$msg = twitter_users($msg);
    		          	}
    					if ($linked != '' || $linked != false) {
    			            if($linked == 'all')  {
    			            	$msg = '<a href="'.$link.'" class="twitter-link">'.$msg.'</a>';  // Puts a link to the status of each tweet
    			            } else {
    			            	$msg = $msg . '<a href="'.$link.'" class="twitter-link">'.$linked.'</a>'; // Puts a link to the status of each tweet
    			            }
    		          	}
    		        	echo $msg;
    
    		        	if($update) {
    		        	    $time = strtotime($message->get_date());
    		        	    if ( ( abs( time() - $time) ) < 86400 ) {
    		        	        $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
    		        		}
    		        	    else {
    		        	        $h_time = date(__('Y/m/d'), $time);
    		        	    }
    
    		        	    echo sprintf( __('%s', 'twitter-for-wordpress'),' <br/><span class="twitter-timestamp"><abbr title="' . date(__('Y/m/d H:i:s'), $time) . '">' . $h_time . '</abbr></span>' );
    		        	}
    					if ($list) echo '</li>';
    					elseif ($num != 1) echo '</p>';
    				} /* end foreach*/
    			} /* close else */
    		}
    		if ($list) echo '</ul>';
    	}
  8. b-summers
    Member
    Posted 1 year ago #

    phenomblue: I've tried using the above code, but I'm still getting the message

    No public Twitter messages

  9. phenomblue
    Member
    Posted 1 year ago #

    b-summers, have you tried manually navigating to http://api.twitter.com/1/statuses/user_timeline/phenomblue.rss (replacing phenomblue with your twitter username) to see if the API call works?

  10. b-summers
    Member
    Posted 1 year ago #

    As far as I can tell it's working:
    http://api.twitter.com/1/statuses/user_timeline/honeycombtweets.rss

    Interesting tho, I can see my tweets this morning, but not last night. Possibly my browser was cached or something.

    In any case it seems to working. Thanks for the code fix phenomblue!!!!

  11. b-summers
    Member
    Posted 1 year ago #

    And now it seems to not be working again....Odd. I haven't changed anything since last night, and since then it's gone from not working, to working, to not working again.

  12. lanjunq
    Member
    Posted 1 year ago #

    @pantaluna
    Very thanks. I downloaded your given script, and it works.
    Hopes author update the plugin, if possible:)

  13. pantaluna
    Member
    Posted 1 year ago #

    @lanjunq Thanks. I'm happy to have made a contribution!

  14. ramsich
    Member
    Posted 1 year ago #

  15. pantaluna
    Member
    Posted 1 year ago #

    HI,
    Twitter has deactivated the REST API V1 https://dev.twitter.com/blog/api-v1-is-retired on Jun13,2013 so this plugin won't work anymore.

    From now on you have to use the REST APi V1.1 and all have to be authenticated https://dev.twitter.com/docs/api/1.1/overview#Authentication_required_on_all_endpoints

    Here is an example of a page that uses the new API V1.1 : http://m.feestdagen-belgie.be/tweets.php

  16. Pjotrw
    Member
    Posted 1 year ago #

    @pantaluna

    Is there an easy fix? Or alternative?

    Thx
    Pjotr

  17. cycyga9
    Member
    Posted 1 year ago #

    I'm pretty much interested in having an alternative too... I am using a theme that manages the twitter API and cannot set it by myself without searching and writing code. It is actually very hard for me to search in someone else's code, I am not such a good developper :-( just understanding some parts of codes.

    Anyway... if somebody knows how to fix it easily, I just wanted to let you know that I'm interested too :-) (that makes 2 people ;-)

  18. pantaluna
    Member
    Posted 1 year ago #

    >Easy fix.
    Maybe you can use this https://dev.twitter.com/docs/embedded-timelines
    and put the code in a wordpress widget (e.g. for the sidebar or so).

  19. cycyga9
    Member
    Posted 1 year ago #

    Many many many (...) many Thanks ! I didn't even know this functionnality exists. Shame on me to not look at twitter's tools first. Thank You pantaluna

  20. favtm
    Member
    Posted 1 year ago #

    I found using Twitter's code (straight from their website) works best on both HTML and WordPress websites no matter the error. I don't know how to give you the link on where to find it exactly, but here's a website with a simple and short tutorial on where to get the new code to fix your error http://inspiredbyidd.com/twitter-timeline-or-feed-not-working-again-heres-the-latest-fix

  21. Peter Booker
    Member
    Posted 1 year ago #

    Due to the difficulty involved in using the v1.1 API, we have released the Kebo Twitter Feed plugin.

    The main advantage over this plugin, compared to others, is that it avoids any technical steps like creating a Twitter App yourself. In a few clicks you can display your latest tweets using a widget, either in a list or fader.

  22. Pjotrw
    Member
    Posted 1 year ago #

    @PeterBooker I'll try your Kebo. It's running now and looks perfect.
    Thank you!!!

    Pjotr

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic