WordPress.org

Support

Support » Plugins and Hacks » WP-PostRatings » Notice: Undefined index: rate in … wp-postratings.php

Notice: Undefined index: rate in … wp-postratings.php

  • Hi everyone. When debugging is turned on on WordPress site, the “Notice: Undefined index: rate in … wp-postratings.php” is always shown at the top of the page? Is there a way to get rid of it?

    Thanks very much 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’ve found out why, there is a bunch of notices when PHP error reporting is set to show all errors. This is because of poor programming practice of wp postratings author to acces GET variables without checking are they even set using isset(). Kind of sloppy.

    Plugin Author Lester Chan

    @gamerz

    This plugin is coded quite sometime back and I usually don’t code with notices on (I know it is bad practice and sloppy!). But this is not really critical when you compare this to additional features or bug fixes.

    Sure Lester, thanks for your work!

    Yes, thanks for the plugins Lester Chan! I’ve found them very useful. I had the same issue as Marko, and it was fixed by adding a line to the wp-postratings php:

    if (isset($_GET['rate']) && isset($_GET['pid'])){

    …before these lines…

    $rate = intval($_GET['rate']);
    $post_id = intval($_GET['pid']);

    (…and, of course, closing with } at the end of the function.)
    I guess you can use it if/when you update the plugin.

    I am not sure that I actually understand the above explanation. Could anyone explain what to do in a more simpel way? I am not that experienced in WP. I have just downloaded WP estore and I keep on getting the “Notice: Undefined index:…” messages in the admin part of the plugin.

    Thanks ;o)

    Plugin Author Lester Chan

    @gamerz

    It is my bad for all the notices, but you should not turn on notices in production. Google for “turn off notices php”

    Don’t really know what you are asking me to do, but solved the problem by inserting this: error_reporting (E_ALL ^ E_NOTICE); in wp_eStore1.php at the top. That worked. I found it on the net. ;o)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Notice: Undefined index: rate in … wp-postratings.php’ is closed to new replies.
Skip to toolbar