There is an included votingapi_views.inc and the readme says to replace the existing on from votingapi. However with v5 there is no votingapi_views.inc as it hasn't been ported yet. Is there a way to get this file to work or is it left over from 4.7?
many thanks
Andy
Comments
Comment #1
hickory commentedThe one that's included should work, if you move it to the votingapi folder and make sure it's included. I'm going to look at making a separate views.inc for jrating soon as well.
Comment #2
AstralP commentedMany thanks, for anyone else needing this just add this line to votingapi.module at the top underneath the define statements:
include_once('votingapi_views.inc');
thanks again for the great module.
Comment #3
schnizZzla commentedI always try to add/change code only if really necessary.
In this case i changed the file name and saved it to
sites\all\modules\views\modules\views_votingapi.inc
It will be included automatically. No code change necessary.
I needed also to edit/save the content type that included a voting field, before the votingapi views were accessible.
Comment #4
hickory commentedThat last bit probably just cleared the cache, so the views were updated.
Comment #5
novon commentedHow does one use this in application?
Comment #6
novon commentedOkay, I included the file, I try to add a node by rating view or any new view with votingapi in the fields and I get this:
Fatal error: Call to undefined function: votingapi_cache_value_types() in /home/suevcom/public_html/modules/votingapi/votingapi_views.inc on line 540
Comment #7
hickory commentedThere are all kinds of problems with VotingAPI's Views integration, and there's supposed to be a separate module in development. Until then, I'm going to make a separate views_jrating.inc that should cover this.
Comment #8
Nikkol commentedAny update to this? I'd like to at least show the rating results in a view, but whenevery I try to add that field I get errors similar to the others above. I followed schnizZzla's suggestion rather than changing any code.
Comment #9
hickory commentedIt's really up to the VotingAPI author, or anyone else who wants to volunteer, to write the Views integration for that module. I might have time to write a separate views file for jrating (like fivestar has), but can't guarantee it as I don't personally need it.
Comment #10
Nikkol commentedI might look at doing something; although I'm totally new to drupal and to php in general. So what do others do if they want a list of the top rated nodes? (It seems silly to have the ability to rate without having the ability to easily analyze that data, which could be done by viewing the nodes differently.)
Comment #11
bcn commentedI recycled some code from the fivestar module (which is a good module also, but i didn't like how the css file was loading on every page even if it wasn't needed), and created a simple jrating_views.inc.
I'm sure that this probably isn't the best way to do this, but i needed to get something working today. I haven't tested the filters either... Use at your own risk!!!
Also, I had to add the following two bits to the jrating.module:
And,
and lastly, I added this css to jrating.css:
Comment #12
hickory commentedThanks noahb. I've committed a version of this to the DRUPAL-5 branch, but haven't checked all the filters and fields fully yet. I don't think the default view is working at the moment either.
Comment #13
bcn commentedYou're right, that the default view doesn't seem to be working either... To be honest i didn't even check it, as i just was in a rush to get a custom view working... When i have a bit of time, i'll check to see what's up with the default view.
Comment #14
levelos commentedHey - I just wanted to follow up on this. So is it NOT currently possible to use voting API fields with views in 5.x?
Comment #15
hickory commentedvotingapi_views.inc (in the VotingAPI package) has now been updated by the maintainer for Drupal 5.
Comment #16
Nikkol commentedI tried this new .inc file and I'm not sure it is working the way it should. I get duplicate results. One for the vote and one for the number of votes. Is this how it's suppose to work? Also, how can I show the stars in the view?
Comment #17
hickory commentedPlease post any further issues about votingapi views integration to the votingapi module issue queue.