The tokens and data selectors below return no values (tested using Rules and Automatic Entity Labels). The token table description says the token may be appended with user_rating or average_rating.
[node:field-fivestar:user_rating] or %node:field-fivestar:user_rating
[node:field-fivestar:average_rating] or %node:field-fivestar:average_rating
Using these tokens or data selectors in all configurations I could conceive of returned no data or error messages. It is curious that these selectors are only available in Rules when the allowed data selector type is text. They are not available for integer or decimal selections.
Setup:
- Drupal 7.18
- Fivestar7.x-2.0-alpha2+5-dev (+entity reference patch)
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | fivestar-fix_rating_tokens-1881874-11.patch | 1.93 KB | awd studio |
| #6 | fivestar-wrong-property-data-1881874-0.patch | 932 bytes | emmene-moi |
Comments
Comment #0.0
LeviThomason commentedtypo corrections
Comment #1
whiteph commentedPlease test with 7.x-2.1 release and report back, as there have been a lot of fixes applied since then.
Comment #2
jetsonjohn commentedToken is not working in Display suite also.
Steps to reproduce:
1. Created a custom field using display suite
2. Added the token in the code
3. Rating is not displaying and also not showing an error
Notice: Undefined index: rating in entity_metadata_field_property_get() (line 438 of sites/all/modules/contrib/entity/modules/callbacks.inc).
This is also the same issue faced to Louis Bob
https://www.drupal.org/node/1741524
Comment #3
haunted commentedHello, i have the same problem, The scenario is the one described here https://www.drupal.org/node/1308114 and i want share to facebook the vote that single users gives to a content, that is the fivestar field in the comment.
The two tokens [comment_fivestar_field:user_rating] and [comment_fivestar_field:average_rating] don't produce any otput.
If i use just [comment_fivestar_field] then it works but the output is like (if for example the rating is 4/5):
4 Average: 4 (1 vote)
While it should be just "4", or "user rating 4", since there is no average value in comment's fivestar field but only a single user's vote.
Thanks.
Comment #4
bluesman2014 commentedI have the same issue
Comment #5
stalecheerios commentedSame issue - following.
Comment #6
emmene-moi commentedProposed patch
Comment #7
kobee commentedSame issue, the token is not returning anything on Metatag
Comment #8
energee commentedThis is still broken, tokens return empty values. Patch above does not correct the issue.
Comment #9
dbt102 commentedComment #10
rot3r1is there any Update or fix?
Comment #11
awd studio commentedHere is my solution.
Patch also provide new property with fivestar rating - "rating_fivestar" (e.g. "4.5, 3.2, 5" etc.). It is useful for using in Schema.org properties like http://schema.org/AggregateRating.
Comment #12
awd studio commentedComment #14
castor-designs commentedApparantly that patch is now part of module code? Because I have these lines in my initial file:
However, the problem is still existing: token are giving empty fields
Comment #15
awd studio commented@Castor-designs, please, try patch from #11, it should solve this problem.
Comment #16
castor-designs commentedHi @AWD Studio I tried to do just that manually but it does not fit my includes/fivestar.field.inc file.
Like for example line 806 is nowhere near this codeblock:
line 806 in my case is
Comment #17
awd studio commentedOk. If it's possible - refill module with current dev-version and apply patch over it.
Or, just replace file "/includes/fivestar.field.inc" (relative to fivestar module), with a file from a link: https://drive.google.com/open?id=1xFDOHgz7bhN44zfoAB4EiBhOpf9NnT9o (it has already patched).
Comment #18
castor-designs commentedI downloaded and uploaded your file and it works perfect! Thank you very much for your help. It is much appreciated!
Comment #19
awd studio commented@Castor-designs, no problem. Good luck with your projects!
Contributors, please, pay your attention, if it possible.
Comment #20
jaram commented@AWD Studio
I'm waiting for this patch very long time :-) but when dev-version is installed, your patch /includes/fivestar.field.inc is replaced but after insert token
[node:field-hodnoceni:average_rating] is showing ,,96,, - can be 4,8?
in page https://recepty.ekucharka.net/recept/1034-svestkovy-kolac-se-zmolenkou
Jarda
Comment #21
jaram commentedMy solution
Comment #22
awd studio commented@jaram, sorry, my patch doesn't do anything with "average_rating" counting. It solves only tokens "rating_count", "user_rating" and "rating_fivestar".
Comment #23
ykoech commentedThank you, #17 solved it.
Comment #24
NWest commentedThe patch works great and now you can see the “user_rating output. But how would you get the “user_rating” to output a value of say; 5 instead of 100 percent, or 3 instead of 60 percent, since I want to used a value of 1-5 in the Schema Review field.
Comment #25
awd studio commented@NWest, unfortunately, I don't remember the whole working process of this issue ))
As I can assume - you need to use the common "rating_fivestar" token, because current user's rating have no sense for the search engine (it is always anonymous), if it need to be used for some SEO aims.
Comment #26
hilrap commented@jaram how did you get your aggregate ratingvalue to echo digits from 1 to 5? Mine is only giving the percentage.
Does
go into the template.php file?
Comment #27
hilrap commentedDoes anyone have a solution for this? #24