Fatal error when using this plugin in more than one widget:
Cannot redeclare twitter_time_diff()
The function is being declared twice when multiple instances of the widget are loaded.
Go to line 226 in twitter_widget.class.php in the controller folder and wrap the twitter_time_diff function with
if(!function_exists('twitter_time_diff')){ }
so you have
if(!function_exists('twitter_time_diff')){
function twitter_time_diff( $from, $to = '' ) {
$diff = human_time_diff($from,$to);
$replace = array(
' hour' => 'h',
' hours' => 'h',
' day' => 'd',
' days' => 'd',
' minute' => 'm',
' minutes' => 'm',
' second' => 's',
' seconds' => 's',
);
return strtr($diff,$replace);
}
}
Hi,
The issue has now been resolved.Now you can add the widget multiple times in the sidebar.
I am putting it out as a bug fix in the latest version 1.4 .
So Please update your plugin to get it fixed.
If you still have any issues after updating the plugin, Please let me know.
——————————————————–
Please do give 5 start Rating if you get your issue fixed
Thanks
Thanks. Now I get this error with the second widget:
Warning: Invalid argument supplied for foreach() in xxx\wp-content\plugins\wp-twitter-feeds\controller\twitter_widget.class.php on line 266
Edit: this error occurs with a specific Twitter account. One out of 10 times it shows the tweets, 9 out of 10 I get the error.
Anyway, the solution is this (posted by dariogene):
In twitter_widget.class.php change:
if(false === ($tweets = get_transient($transName) ) ) {
to this
if(false === ($tweets = unserialize(base64_decode(get_transient($transName))) ) ) {
and then change:
set_transient($transName, $tweets, 60 * $timeto_store);
to this
set_transient($transName, base64_encode(serialize($tweets)), 60 * $timeto_store);