Ratings

0

I am having problems with ratings...I simply added the package and didn't really modify any of the code...

I have to problems:

  1. when I rate, I often get this pop-up message -- <e> Error: Rating Invalid. -- which is supposed to come up when the vote is outside of range 1 to 5 (which, to be honest, i am not sure how that is supposed to happen)
  2. the votes don't display...{@rating,rating/show} just shows an empty line...

this is the page:

http://www.wahakamezcal.com/recipes/

the blank line after the recipe name is supposed to show the rating...you can test the voting on a recipe's page (ie, click through to any recipe)

I am not sure where to start trying to fix this...any help is appreciated...

TIA...

asked Jan 31 at 7:23

raza

5

add comment
enter at least 15 characters

10 Answers

0

Yes. You need to enqueue jQuery if your theme isn't already doing it. Here is how.

Of course, you can probably make all this work easier if you switch to Pods pages.

answered Feb 1 at 12:47

chris.pilko

889

edited Feb 1 at 1:34

add comment
enter at least 15 characters
0

Something modified the javascript code in your rating_star5 display helper and converted the & characters at line 73 (begins with "data:" ) to their HTML equivalents of &038;.

I have seen this happen on some of my sites. Others have reported similar problems in this forum. I believe there is a WP upgrade that is the culprit, but it hasn't happened frequently enough for me to be able to track down the source.

The net result is that when you click a star, the value is POSTed to the field "#038;vote". The field "vote" is undefined, which is why the out of range error occurs.

answered Jan 31 at 3:52

chris.pilko

889

edited Jan 31 at 3:52

add comment
enter at least 15 characters
0

I think it happened when I upgraded to wp 3.3.1...it seems to be something that is happening dynamically though because, if I look at the code in my admin panel, it looks good:

data: "pod=" + rating_id_parts[1] + "&id=" + rating_id_parts[2] + "&field=" + rating_id_parts[3] + "&vote=" + rating,

I'll try re-installing the ratings code to see if it miraculously works...

thanks for the clues...

answered Jan 31 at 6:09

raza

5

add comment
enter at least 15 characters
0

If the code is right in the edit window, but it is showing up in your generated code, make sure you aren't passing the output of pod_helper('rating_star5') through wpautop or any other wordpress "cleanup" functions.

answered Jan 31 at 6:29

chris.pilko

889

add comment
enter at least 15 characters
0

I am using this plug-in which (theoretically) should not pass the output through wpautop and other cleanup functions...

http://wordpress.org/extend/plugins/ps-disable-auto-formatting/

if i disable that plugin, i still have the problem...

answered Jan 31 at 6:56

raza

5

add comment
enter at least 15 characters
0

Are you embedding this with a shortcode? If so, that is most likely your problem. To make that work, you'll have to move all of the code from the <style> tag through the </script> tag from your helper into your theme's head.php file.

answered Jan 31 at 7:20

chris.pilko

889

add comment
enter at least 15 characters
0

yes, i am using shortcode...i moved the script to the header.php but it still doesn't work...

maybe i'll switch up the shortcode to PHP...see if that works...

answered Jan 31 at 11:46

raza

5

add comment
enter at least 15 characters
0

Now I don't get the error but it still doesn't work...

i see this in firebug:

jQuery is not defined

[Break On This Error] jQuery(document).ready(function() {

is there some other script that needs to go in header/php?? I just cut and pasted that one from the 'rating/star5' helper...

answered Feb 1 at 7:57

raza

5

add comment
enter at least 15 characters
0

thanks for all your help, chris...

i am in the midst of writing the PHP...which i think is the easiest route...

i use PagelinesPro and it has its own way of using js scripts...so that one is not editing header.php and not able to upgrade...their method to include js scripts isn't that hard but i've never done it...page with PHP seems the easiest route...

answered Feb 1 at 4:19

raza

5

add comment
enter at least 15 characters
0

well, for good or for bad, after a bit of googling, the easiest way to solve this (though who knows if something else will break) was to remove this line from formatting.php:

Line 89

$curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&#038;$1', $curl);

Also, I'll have to remember to re-do this on next WP upgrade

answered Feb 2 at 5:14

raza

5

add comment
enter at least 15 characters