Recent Topics

Twitter plugin error undefined property $screen_name

Started by on Jul 30, 2013 – Contents updated: Aug 07, 2013

Jul 30, 2013 22:49    

Hello. I am linking my blog to Twitter and it states that "Twitter plugin was initialized successfully!"

However I also receive this notice:

"Undefined property: stdClass::$screen_name in /home/iyoodle/public_html/plugins/twitter_plugin/_twitter.plugin.php on line 305"

Here is the code from _twitter.plugin.php (line 305 is labeled):

PHP

/**
     * Get twitter contact display name
     *
     * @access private
     *
     * @param string oauth_token
     * @param string oauth tokensecret
     * @return string contact display name on success, empty string on error
     */
    function get_twitter_contact$oauth_token$oauth_token_secret )
    {
        $connection = new TwitterOAuth(TWITTER_CONSUMER_KEYTWITTER_CONSUMER_SECRET$oauth_token$oauth_token_secret );
        // get linked user account
        $account $connection->get('account/verify_credentials');
        if( empty($account->error) )
        {
305            return $account->screen_name;
        }
        return '';
    }

Thus when I post a blog, it does not post on Twitter.

This plugin was working previously and now is not.

Does anyone have any insight to this?

Thank you for your time.

Jul 30, 2013 22:59

What version of b2evo are you using?

Jul 30, 2013 23:48

Hello. It is the latest version although I am not able to supply the version as it's not labeled. A b2veo developer has modified my version although I don't believe that anything that has been modified would affect the Twitter plugin which was working.

My site is: http://www.iYoodle.com

Aug 02, 2013 22:17

I know the twitter plugin has been fixed in 5.0.4, but if your b2evoution has been modified enough to hide the version number, you should definitely go talk to your developer.

Aug 04, 2013 05:10

Twitter returns an array of users, so we should just get the first one.

PHP

function get_twitter_contact$oauth_token$oauth_token_secret )
{
    $connection = new TwitterOAuth(TWITTER_CONSUMER_KEYTWITTER_CONSUMER_SECRET$oauth_token$oauth_token_secret );
    // get linked user account
    $account $connection->get('account/verify_credentials');
    if( empty( $account->errors ) )
    {
        if( is_array($account) )
        {
            $account $account[0];
        }
        return $account->screen_name;
    }
    return '';
}

Aug 05, 2013 07:14

I replaced the code and it worked flawlessly. Thank you much.

Aug 05, 2013 23:05

@kittenplay
Just wondering if you received my email? There was a problem on my mail server

Aug 05, 2013 23:30

Yes, I did. Let me know if you don't receive my reply.


Form is loading...

CMS software – This forum is powered by b2evolution CMS, a complete engine for your website.