Viewing 1 replies (of 1 total)
  • I’ve had this same problem myself and a quick google reveals many other sites with the same problem.

    The problem is to do with get_transient() and set_transient(). What is happening is that the plugin is trying to cache and retrieve tweets with certain characters in them that won’t serialize/unserialize correctly. So the function just returns the serialized data rather than array, which the foreach cannot handle.

    So to get around this, you need to serialize and encode the tweet array before passing it to set_transient. And then on the get_transient call you need to decode and unserialize.

    So 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);

    Hope this helps. As per stackoverflow and another twitter plugin

Viewing 1 replies (of 1 total)
  • The topic ‘Warning: Invalid argument supplied for foreach()’ is closed to new replies.