Support » Plugin: Easy Popular Posts » Error after updating to 2.5.3

  • Warning: arsort() expects parameter 1 to be array, null given in …/wp-content/plugins/easy-popular-posts/easy-popular-posts.php on line 83

    Warning: Invalid argument supplied for foreach() in …/wp-content/plugins/easy-popular-posts/easy-popular-posts.php on line 85

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’ve got the same problem when I update to version Version 2.5.4 (with WordPress 3.2.1.) :

    Warning: Invalid argument supplied for foreach() in /domains/blog.drweigert.nl/DEFAULT/wp-content/plugins/easy-popular-posts/easy-popular-posts.php on line 85

    Ron, could you tell me how you’re calling the code?

    I can’t seem to replicate the error.

    Chris

    Thread Starter knaber

    (@knaber)

    Here’s how I’m calling mine:

    <?php thisismyurl_easy_popular_posts('count=8&credit=false&show=true'); ?>

    Sorry for my late reply.
    I’m using it as a widget in the main widget area.

    Same for me : got the “Invalid argument supplied for foreach() in /website.com/wp-content/plugins/easy-popular-posts/easy-popular-posts.php on line 85”

    I’ve tried both with widget + calling code : same result.

    I wish I had an easy answer for you guys but I can’t reproduce the error, I’m running the code on http://thisismyurl.com as a widget and when I trie inserting @knaber’s code, it works as well.

    If anybody has a test server that the code isn’t working in I would love to fix this, please send me an email if you’re able to help, I’ll take a look right away.

    Ola Chris,

    I re-produced the error:
    on default the ‘Display Type:’ is set on ‘comments’; i’ve i change this to ‘total’, the error is gone.
    (I did post a few dummy comments though..)

    Thread Starter knaber

    (@knaber)

    I can’t get it to work. Anyone else find a fix?

    I ran into this as well. Could it be due to the number of comments being counted? I didn’t dig into it too deeply, but this change to the code seemed to solve the problem for me (just wrapping the first code block here with an if statement checking if the $myposts variable exists):

    Changed:

    foreach ($myposts as $key=>$value) {
    
    	if (count($popular_posts) <= $ns_options['count'] && $value > 0) {
    		$popular_posts[]->ID = $key;
    	}
    }

    To:

    if ($myposts) {
    
    	foreach ($myposts as $key=>$value) {
    
    		if (count($popular_posts) <= $ns_options['count'] && $value > 0) {
    			$popular_posts[]->ID = $key;
    		}
    	}
    }

    Thanks @bparlzek, I still can’t replicate the error myself but your code addition makes perfect sense and will hopefully solve some of the problems people are having.

    I’ve uploaded a new version (2.5.5) and as always, welcome the help!

    Chris

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Error after updating to 2.5.3’ is closed to new replies.