"No Tweets Available"… mostly
-
Either the new update broke my plugin or the timing of this error is coincidental— I get “No Tweets Available” 9 times out of 10 on my site https://cl.ly/2n0o1F1I241R at the very bottom
Site has rather low traffic, and it seemed okay once I got the plugin updated but while working on CSS it just suddenly stopped working *most* of the time. Occasionally I will reload the page and see a few tweets. My code:
<?php echo do_shortcode(' [twitter-widget username="YamamotoIND" hidereplies=false hidefrom=false avatar=small items=7 title=TWITTER showfollow=false showretweets=true showintents=false fetchTimeOut=60 showts=30]'); ?>
https://www.ads-software.com/extend/plugins/twitter-widget-pro/
-
Hello again. Just chiming in to confirm that the issue still exists after the 2.6.0 update.
Aaron (the author), can you give us a quick shout with regards to a possible fix? Moondrop seems to have found something, but fiddling with source files is not really an option.
Feel free to contact me @rootside on Twitter about testing and/or access to my test install, but I think the problem is easily reproducible.
Thanks
I have experienced the same problem with emojis. I used the Emoji keyboard in iOS 6 to post a tweet. I specifically used the smiley face emoji ?? and all tweets disappeared resulting in the message “No tweets available” being displayed.
Hello, here is a great article on why emojis becomes a problem with a mysql-db: https://pjambet.github.io/blog/emojis-and-mysql/
I can confirm that the proposed fix works fine to fix the special characters (emoji) problem.
Simply open up tlc-transients.php (after making a backup copy of it!) and anywhere that you see a line like:
get_transients(…..);
change this to:
unserialize(base64_decode(get_transient(…..)));
and anywhere you see a line like:
set_transients(…..);
change this to:
set_transient(base64_encode(serialize(…..)));
Obviously, the next time you upgrade the component, this file is likely to be overwritten, so make a backup of your changed file too.
OpenGlobal E-commerce
This doesn’t work in this instance, using this method – not correctly anyhow. The posts appear initially and display normally within the feed – but give it some time and a page refresh and I get:
Warning: base64_decode() expects parameter 1 to be string, array given in /websites/…………/wp-content/plugins/twitter-widget-pro/tlc-transients.php on line 48
So not a solution, at least not done in this way. More work needed.
If anyone has this plugin working consistently 100% using this method, or in fact any other method, please post the full tlc-transients.php code and I would love to give it a try.
Thanks in advance.
MESSAGE TO THE DEV: Please help us out with this : ) This is BY FAR the cleanest and cleverest widget for displaying twitter feed I’ve found. There’s just this one big issue and it appears to be causing a problem for so many of us. I know your support is provided for free, and I for one really appreciate your time, knowledge and effort.
But in honesty, I’d rather you pull non-functioning plugin and we will all go elsewhere, make our money, and enjoy our free time.ANY input would be appreciated. even if its ” I will look at this in 6 months – come back then” – All the best.
I finally sacked this plugin, and after a few minutes of work with a plugin called Simple Twitter Tweets (https://www.planet-interactive.co.uk/simple-twitter-tweets/#options) I can recommend it.
I finally got the plugin to work correctly on my site with no errors! I did tests with the emoji icons in my tweets and everything seemed to work. Thanks to OpenGlobal, moondrop and jensnilsson’s posts. It was some hard work but I think I’ve successfully fixed it.
If you’re using MySQL, make sure that your database is set to use utf8mb4 NOT utf8. Also, make sure that all tables in the database are set to utf8mb4 as well. Just follow the steps in the link posted by jensnilsson. The tlc-transients php file must be fixed as well which I’ve posted the code below.
Just make sure to backup your database and tlc-transients php file in case something goes wrong. I hope this helps those that are having problems!
<?php if ( !class_exists( 'TLC_Transient_Update_Server' ) ) { class TLC_Transient_Update_Server { public function __construct() { add_action( 'init', array( $this, 'init' ) ); } public function init() { if ( isset( $_POST['_tlc_update'] ) && ( 0 === strpos( $_POST['_tlc_update'], 'tlc_lock_' ) ) && isset( $_POST['key'] ) ) { $update = unserialize(base64_decode(get_transient( 'tlc_up__' . md5( $_POST['key'] ) ))); if ( $update && $update[0] == $_POST['_tlc_update'] ) { tlc_transient( $update[1] ) ->expires_in( $update[2] ) ->extend_on_fail( $update[5] ) ->updates_with( $update[3], (array) $update[4] ) ->set_lock( $update[0] ) ->fetch_and_cache(); } exit(); } } } new TLC_Transient_Update_Server; } if ( !class_exists( 'TLC_Transient' ) ) { class TLC_Transient { public $key; public $raw_key; private $lock; private $callback; private $params; private $expiration = 0; private $extend_on_fail = 0; private $force_background_updates = false; public function __construct( $key ) { $this->raw_key = $key; $this->key = md5( $key ); } private function raw_get() { return unserialize(base64_decode(get_transient( 'tlc__' . $this->key ))); } public function get() { $data = $this->raw_get(); if ( false === $data ) { // Hard expiration if ( $this->force_background_updates ) { // In this mode, we never do a just-in-time update // We return false, and schedule a fetch on shutdown $this->schedule_background_fetch(); return false; } else { // Bill O'Reilly mode: "We'll do it live!" return $this->fetch_and_cache(); } } else { // Soft expiration if ( $data[0] !== 0 && $data[0] < time() ) $this->schedule_background_fetch(); return $data[1]; } } private function schedule_background_fetch() { if ( !$this->has_update_lock() ) { set_transient(base64_encode(serialize( 'tlc_up__' . $this->key, array( $this->new_update_lock(), $this->raw_key, $this->expiration, $this->callback, $this->params, $this->extend_on_fail ), 300 ))); add_action( 'shutdown', array( $this, 'spawn_server' ) ); } return $this; } public function spawn_server() { $server_url = home_url( '/?tlc_transients_request' ); wp_remote_post( $server_url, array( 'body' => array( '_tlc_update' => $this->lock, 'key' => $this->raw_key ), 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) ); } public function fetch_and_cache() { // If you don't supply a callback, we can't update it for you! if ( empty( $this->callback ) ) return false; if ( $this->has_update_lock() && !$this->owns_update_lock() ) return; // Race... let the other process handle it try { $data = call_user_func_array( $this->callback, $this->params ); $this->set( $data ); } catch( Exception $e ) { if ( $this->extend_on_fail > 0 ) { $data = $this->raw_get(); if ( $data ) { $data = $data[1]; $old_expiration = $this->expiration; $this->expiration = $this->extend_on_fail; $this->set( $data ); $this->expiration = $old_expiration; } } else { $data = false; } } $this->release_update_lock(); return $data; } public function set( $data ) { // We set the timeout as part of the transient data. // The actual transient has a far-future TTL. This allows for soft expiration. $expiration = ( $this->expiration > 0 ) ? time() + $this->expiration : 0; $transient_expiration = ( $this->expiration > 0 ) ? $this->expiration + 31536000 : 0; // 31536000 = 60*60*24*365 ~= one year set_transient(base64_encode(serialize( 'tlc__' . $this->key, array( $expiration, $data ), $transient_expiration ))); return $this; } public function updates_with( $callback, $params = array() ) { $this->callback = $callback; if ( is_array( $params ) ) $this->params = $params; return $this; } private function new_update_lock() { $this->lock = uniqid( 'tlc_lock_', true ); return $this->lock; } private function release_update_lock() { delete_transient( 'tlc_up__' . $this->key ); } private function get_update_lock() { $lock = unserialize(base64_decode(get_transient( 'tlc_up__' . $this->key ))); if ( $lock ) return $lock[0]; else return false; } private function has_update_lock() { return (bool) $this->get_update_lock(); } private function owns_update_lock() { return $this->lock == $this->get_update_lock(); } public function expires_in( $seconds ) { $this->expiration = (int) $seconds; return $this; } public function extend_on_fail( $seconds ) { $this->extend_on_fail = (int) $seconds; return $this; } public function set_lock( $lock ) { $this->lock = $lock; return $this; } public function background_only() { $this->force_background_updates = true; return $this; } } } // API so you don't have to use "new" if ( !function_exists( 'tlc_transient' ) ) { function tlc_transient( $key ) { $transient = new TLC_Transient( $key ); return $transient; } } // Example: /* function sample_fetch_and_append( $url, $append ) { $f = wp_remote_retrieve_body( wp_remote_get( $url, array( 'timeout' => 30 ) ) ); $f .= $append; return $f; } function test_tlc_transient() { $t = tlc_transient( 'foo' ) ->expires_in( 30 ) ->background_only() ->updates_with( 'sample_fetch_and_append', array( 'https://coveredwebservices.com/tools/long-running-request.php', ' appendfooparam ' ) ) ->get(); var_dump( $t ); if ( !$t ) echo "The request is false, because it isn't yet in the cache. It'll be there in about 10 seconds. Keep refreshing!"; } add_action( 'wp_footer', 'test_tlc_transient' ); */
- The topic ‘"No Tweets Available"… mostly’ is closed to new replies.