lesterchan / wp-postratings

Adds an AJAX rating system for your WordPress blog's post/page.
https://wordpress.org/plugins/wp-postratings/
123 stars 82 forks source link

Warning when a not existing page is called #155

Open 8ctopus opened 2 years ago

8ctopus commented 2 years ago

Just found a small issue with the plugin: When a not existing article on the site is being called, wp-postratings generates a warning as shown in the screenshot. I tried a quick fix but without luck.

2022-05-17_151835

lesterchan commented 2 years ago

When you activate the plugin, it will create the options automatically. In this case, it fails on your end? https://github.com/lesterchan/wp-postratings/blob/master/includes/postratings-activation.php#L73

8ctopus commented 1 year ago

I've had a look at this issue again today because it keeps popping in our Apache error logs every single day.

The problem occurs when someone tries to load a page that doesn't exist: $postratings_ajax_style = false in this case. While when the page exists, $postratings_ajax_style = ['loading' => 0, 'fading' => 1];.

I'll send you a PR in a few minutes that fixes the problem for me.