jystewart
Forum Replies Created
-
Forum: Plugins
In reply to: [Twitter for Wordpress] Twitter for WordPress broken on upgrade to 3.1bassoo, you’ve hit on an element of the code I’m not using and so hadn’t updated.
I don’t have a line 91 in my amended copy, but line 92 is:
$time = strtotime($message['pubdate']);which shows the plugin still using $message as an array rather than the object that it is. I can’t remember how the SimplePie API exposes pubdate (should be easy to find in the docs) but you’ll need that to become something along the lines of:
$time = strtotime($message->get_pubdate());The plugin definitely needs a more thorough overhaul than I’ve had time for. Hopefully the original author could do that? I’m definitely not going to have any time before May.
Forum: Plugins
In reply to: [Twitter for Wordpress] Twitter for WordPress broken on upgrade to 3.1Sure. Sorry to not get back sooner but I was away at SxSW.
I tried to generate a diff but for some reason I’m getting the entire file as a diff (I may have changed the indentation style or something), so instead here’s my version of the twitter_messages() function, which is the only thing I changed. To update the plugin properly some related changes need to be made elsewhere, and I suspect there’s now some redundant code that should be removed?
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 . '/class-simplepie.php'); $messages = fetch_feed('http://twitter.com/statuses/user_timeline/'.$username.'.rss'); $items = $messages->get_items(); if ($list) echo '<ul class="twitter">'; if ($username == '') { if ($list) echo '<li>'; echo 'RSS not configured'; if ($list) echo '</li>'; } else { if ( empty($items) ) { if ($list) echo '<li>'; echo 'No public Twitter messages.'; if ($list) echo '</li>'; } else { $i = 0; foreach ( $items 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>'; $i++; if ( $i >= $num ) break; } } } if ($list) echo '</ul>'; }Forum: Plugins
In reply to: [Twitter for Wordpress] Twitter for WordPress broken on upgrade to 3.1The RSS handling that Twitter for WordPress uses was deprecated in WP 3 and isn’t supported in WP 3.1. I’ve managed to get my copy working by changing references to:
include_once(ABSPATH . WPINC . '/class-simplepie.php');to
include_once(ABSPATH . WPINC . '/rss.php');replacing calls to
fetch_rss()with
fetch_feed()and then making some modifications to work with the SimplePie object that’s returned (see http://simplepie.org/wiki/setup/sample_page for an example of SimplePie in action).
I’ve only changed the pieces I absolutely need and don’t have time right now to produce and submit a complete patch but it shouldn’t take someone who knows the plugin code long to make the necessary changes.
I should say that my solution in the short term is to remove the filter before running my code, and then re-adding it after I’ve got what I need. Hardly ideal, but it works.
Having just installed the 2.0.5 upgrade I had to address this again.
This time rather than patch the plugin I changed the priority on my filter so that WP ran it after the plugin’s own filter, which means I’m no longer reliant on patching the plugin.
That was okay for me to implement, but the way this works is still unclear and adds unnecessary confusion. Ideally the patch I provided above would be applied, but at the very least the priority of the internal filter ought to be set to something lower than the default value of 10 so that the plugin’s internal filter will be run before other filters defined with the default settings.
Thanks. That’s odd – I’d just done fresh downloads and re-uploaded all my plugins after the upgrade to WP 3.0.1.
Upgrading seems to have fixed everything. Thanks!