Support » Plugin: Simple Twitter Connect » [Plugin: Simple Twitter Connect] widget not working: get errors

  • Tevya

    (@thefiddler)


    Instead of the sidebar widget showing the followers, I get this:

    Warning: shuffle() expects parameter 1 to be array, object given in /xxx-address-here/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 135
    
    Warning: array_slice() expects parameter 1 to be array, object given in /xxx-address-here/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 136
    
    Warning: Invalid argument supplied for foreach() in /xxx-address-here/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 144

    What have I done wrong? I setup the twitter app and put the codes in, then gave access to the twitter account. I enabled Followers Widget, Publish, and Twitter Dashboard. Then inserted the widget in the sidebar. That’s all I’ve done, but I get the above error codes instead of the widget. Any ideas?

    Also, is it possible to insert the widget manually? I’m using suffusion theme and would like to put it in the tabbed widget instead of just on the sidebar. Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Tevya

    (@thefiddler)

    Any help? This is the main reason I installed this plugin.

    DevonHarper

    (@devonharper)

    I am having the same problem with the plugin on my site. I was seeing the following errors:

    Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /public_html/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 109

    Warning: implode() [function.implode]: Invalid arguments passed in /public_html/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 116

    Warning: shuffle() expects parameter 1 to be array, object given in /public_html/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 137

    Warning: array_slice() expects parameter 1 to be array, object given in /public_html/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 138

    Warning: Invalid argument supplied for foreach() in /public_html/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 146

    I was able to trace the problem down to one simple fact, the twitter account I was testing with had less than 100 followers. I was able to fix the problem by updating line 107 of stc-followers.php to:

    $num_req = (count($fols)<100) ? count($fols) : 100;
    $fols = array_rand(array_flip($fols), $num_req);

    I also had to clear out the transient entries for the widget from my database. But it is working for me now.

    TheVirtualPreacher

    (@thevirtualpreacher)

    Thanks for the solution. It worked but there’s a new problem. The avatars appear one after the other… Like,

    Avatar 1

    Avatar 2

    Avatar 3

    and so on…

    TheVirtualPreacher

    (@thevirtualpreacher)

    It seems the problem is with CSS (according to the plugin FAQ). I know nothing about CSS… Searching for an alternative plugin.

    I was using “Twitter Followers” plugin so far but it’s broken due to Twitter API’s OAuth only feature!!!

    I am having the same problem:

    Warning: shuffle() expects parameter 1 to be array, object given in /xxx-address-here/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 135

    Warning: array_slice() expects parameter 1 to be array, object given in /xxx-address-here/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 136

    Warning: Invalid argument supplied for foreach() in /xxx-address-here/wp-content/plugins/simple-twitter-connect/stc-followers.php on line 144

    any one help me pleaz. i also tried to change stc-followers as described above but dont know how to delete the transient entries for the widget so the errors are still there, pleaz help me

    The transient entries for the widget are entries in the wp_options table of the database. I found 4 entries in my database that I had to manually delete in order for the widget to update itself and fix the errors I was having.

    _transient_stc_followers_TWITTERACCOUNT_count
    _transient_timeout_stc_followers_TWITTERACCOUNT
    _transient_stc_followers_TWITTERACCOUNT
    _transient_timeout_stc_followers_TWITTERACCOUNT_count

    Where TWITTERACCOUNT is the twitter account name for your configuration.

    I uploaded the changes to the stc-followers.php to the server, deleted the 4 entries from the database, and then refreshed the blog page.

    Thanks @devonharper — works like a charm. 😉

    One additional note — the code initially looks like this:

    $fols = $resp->ids;
    $fols = array_rand(array_flip($fols),100);

    You want it to look like this:

    $fols = $resp->ids;
    	$num_req = (count($fols)<100) ? count($fols) : 100;
    	$fols = array_rand(array_flip($fols), $num_req);

    In other words, keep line 106 in there. I didn’t initially, but it’s required of course…

    The double fix of the wp-config.php and the database entry has fixed it for me, although I do have a problem with the vertical list of names- as opposed to the grid…

    Sigh… I’ll try to figure this out, I guess…

    Okay can anyone help with Otto’s great Simple Twitter Connect plugin.

    I have it working but the list comes in like
    Avatar 1
    Avatar 2
    Avatar 3

    and not in box form. None of the box displays at all. I am using the Collective theme by Maximus. I would like to have it display essentially like it does everywhere, including Otto’s blog pages at ottopress.com.

    The readme mentions modifying the CSS, including the .twitter-avatar, but I can’t seem to figure it out.

    Anybody got some advice…?

    @henry Lange this is what I’m using in mine to style it. It’s basically what’s in stc-followers.php with the width and added padding to fit my theme.

    .stc-follower-username{
    text-align:center;
    font-size:15px;
    margin:0;
    }
    .stc-follower-username a {
    color:blue;
    }
    .stc-follower-box {
    border:1px #94a3c4 solid;
    background:#fff;
    width:200px;
    }
    .stc-follower-head {
    background:#eceff5;
    border-bottom:1px #d8dfea solid;
    margin-bottom:6px;
    }
    .stc-follower {
    float:left;
    width:50px;
    padding-right: 10px;
    padding-left:5px;
    height:70px;
    }
    .stc-follower-name {
    text-align:center;
    width:50px;
    font-size:9px;
    overflow:hidden;
    }
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Simple Twitter Connect] widget not working: get errors’ is closed to new replies.