I have been playing around some more with the multi axis feature of fivestar and tried out a view displaying title + multi ratings on the same node. The functionality itself seems work just fine, but I found a bug while testing around. It seems that when you enter a space in the voting tag name, it raises an error in the SQL that views make. I took a look at the raw SQL and it seems that the space in the tag name is used unformatted as space in the SQL, which is what causes the error. I haven't done views integration before, but if we could convert spaces to underscores somewhere behind the scenes, that should fix the problem.
~Jakob
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | views_SQL_fix_1.patch | 1.32 KB | googletorp |
Comments
Comment #1
googletorp commentedAfter getting more familiar with fivestars I took a stab at this bug as well. I'm not sure if this is the way to go, but it is a simple fix for spaces tag names. I used str_replace() to convert spaces to underscores when casting and getting votes which seems to work fine and makes views happy as well.
~Jakob
Comment #2
quicksketchThanks for your excellent patches googletorp. I think I'd prefer to not allow spaces at all in the tag names. Perhaps we could simply enforce all-lowercase, alpha numeric tag names at admin/settings/fivestar? The tag name is also frequently used with URLs, so any sort of non-safe character could cause problems in more locations than just views.
Comment #3
googletorp commentedSince atm Fivestar by default use the tag name given when displaying it on the widgets, it might be a good idea to change the form for adding/removing tags. I'm thinking that we could do something like the node form, where you would have to enter both a machine and human name for the tag. Then we could use the machine name internally while rendering the human name on the widgets ect. All you would really need to add, would be a validation method to check the machine name. I was thinking that we could make the form so you would either add or delete the tags one by one. Maybe we could make it an AJAX call and just handle that part for itself, but keeping it on the same page. It would also make it easier to delete the variables related to the tag as we get a delete request for each tag.
I haven't looked much at the display portion of Fivestar, but I'm thinking if the machine name would replace the current tag name, all we would really need to do, would be to save a variable with the human name and just use that for display. It shouldn't require that much change (I hope).
If you think this direction would be a good idea, I wouldn't mind looking through the code and try to make a patch for it.
Comment #4
whiteph commentedWe can no longer support the Drupal 6 version of Fivestar. It is in security maintenance mode only. When the Drupal 8 version of Fivestar is released, the Drupal 6 version will be officially deprecated. However, if a volunteer can be found who is willing to test patches for the Drupal 6 version, we could revert it to normal maintenance. See Help testing Drupal 6 patches.