WordPress.org

Ready to get started?Download WordPress

Forums

Twitter Tracker
[resolved] Page generation stops on Twitter Tracker error (4 posts)

  1. kwdavids
    Member
    Posted 1 year ago #

    I just installed Twitter Tracker, authorized with Twitter, and added Twitter Search Tracker to the sidebar. After that the HTML page generation stops immediately after the title for the Widget with a PHP error in the error_log.

    Here are the settings (if not listed, blank):

    Title: Twitter feed
    Twitter search: #this_that
    Max tweets to show: 6
    Hide @ replies: checked
    Include retweets: checked
    Hide all Emoji: selected

    I have the WP Widget Cache plug-in installed. I found this in my error_log:

    07-Aug-2013 13:33:10 UTC] PHP Fatal error: Call to a member function remove_replies() on a non-object in .../wp-content/plugins/twitter-tracker/twitter-tracker.php on line 251

    http://wordpress.org/plugins/twitter-tracker/

  2. Bas Schuiling
    Member
    Posted 1 year ago #

    I came to look here since I have the exact same error. Strange thing is Twitter Tracker has been running here already for nearly a year without much problems. So something has changed somewhere since it gives fatal errors at the moment.

  3. Bas Schuiling
    Member
    Posted 1 year ago #

    I think it's connected to the new version. I tested an older version of Twitter Tracker- which doesn't work anymore because of the need for authorization from Twitter -and it doesn't give the error.

    Problem arises when a twitter search is done and no results are found. The $response object then is empty (and not an object).

    I have made a quick fix which seems to work ( didn't do an awful lot of testing so beware ) :

    if ( is_wp_error( $response ) ) {
    			error_log( "Twitter Tracker response error: " . print_r( $response, true ) );
    			return;
    		}
    
    // begin fix
    	if (! is_object($response))
    	{
    			$vars = array(
    				'msg' => __( 'No tweets!', 'twitter-tracker' ),
    			);
    			$this->render( 'widget-error', $vars );
    			return;
    
    	}
    
    // end fix
    
    if ( $hide_replies )
    	$response->remove_replies();

    Insert the code between start and end fix between the two statements that are around line 250 and it will give an nice error that no tweets are found instead of a fatal error.

    Plugin author probably should implement a better fix or return an emtpy object that still works if things are not found. :)

  4. kwdavids
    Member
    Posted 1 year ago #

    Super. That worked. I wasn't aware that the query was empty, but apparently it was.

    Thanks so much.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic