I am using all the latest versions of CCK, Views (Head) and Voting API and Fivestar modules.

I would like to be able to use views to list a CCK node type by Title and its popularity (fivestar direct enabled on the content type). When constructing the view, there is no field to select the nodes 5 star rating/vote.

Thanks in advance for your help!

Comments

sniurkst’s picture

Hi,

I am having the same issue with newest versions of Views, VotingAPI and Fivestar (Drupal6). While I have red that VotingAPI is already "connected" with Views and people are succesfully using it - I can not see anything related to voting neither in fields nor in filter selects. Node types I am working with has Fivestar fields.

I would be thankful for any advice relating this problem too.

And sorry for bad English.

- Sniurkst

ToddThomson’s picture

Release notes for Views-RC2 mention that the Views handler functions were re-org'd with a resulting API changed that effects all modules that have a dependency on Views.

I am sure the maintainers of the votingAPI module are working on resolving this issue!

eaton’s picture

Yep. The updated code is written, and should be checked in shortly. Votingapi 2.0RC1 will be rolled before this weekend.

Flying Drupalist’s picture

Thank you very much, subscribing.

mercmobily’s picture

Subscribed

misterlawrence’s picture

subscribed.

gordonbooker’s picture

Great, looking forward to using this in Drupal 6

Flying Drupalist’s picture

Priority: Normal » Critical
Flying Drupalist’s picture

Status: Active » Fixed
kevindoole’s picture

Is this actually fixed now?
i've got the latest versions of everything, i've cleared caches, i've set up the relationships, i've created new views from scratch, i've tested various configurations...

it just won't display anything vote-related.
if i set up a view with a voteingAPI relationship, it invariably displays no results.

i had about 10 blocks displaying different content sorted by votes that worked totally fine until upgrading to the new views.
then they just displayed random content so i updated votingAPI.
now they just display nothing.

is it just me? (probably)

mercmobily’s picture

Status: Fixed » Active

Hi,

I am experiencing the same.
Reopening it... sorry guys.

Merc.

eaton’s picture

Please post the details of what version of VotingAPI you WERE using, what version you ARE NOW using, and an export of the view. Without that information, there's no way to determine what if anything is wrong.

Please note: With VotingAPI 2.0, you must add a relationship for vote data before any votingapi fields, sorts, or arguments can be added. If you upgrade from Views 2.0rc1 to rc2 later, you must use VotingAPI rc1 or later. When upgrading to those modules, you must also clear the views cache or the new API changes will not be recognized.

Flying Drupalist’s picture

Sorry for being presumptuous, I updated the status after testing it and finding that it worked for me. So here's a vote as one who got it working.

mercmobily’s picture

Hi,

Actually, while gathering more information, I figured that I did something immensely stupid.
Please ignore #11.

Merc.

eaton’s picture

No problem! I've broken things more times than I can count while testing some of this stuff. ;-) Just wanting to make sure that any unnoticed problems get ironed out before an official release. Thanks!

kevindoole’s picture

ok, here's one of the views that was working before i ugraded and now doesn't work:

$view = new view;
$view->name = 'comment_toprated';
$view->description = 'Top Rated COMMENT Articles';
$view->tag = 'tops';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
  'votingapi_cache' => array(
    'label' => 'Voting results',
    'required' => 1,
    'votingapi' => array(
      'value_type' => 'percent',
      'tag' => 'vote',
      'function' => 'average',
    ),
    'id' => 'votingapi_cache',
    'table' => 'node',
    'field' => 'votingapi_cache',
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'value' => array(
    'order' => 'DESC',
    'id' => 'value',
    'table' => 'votingapi_cache',
    'field' => 'value',
    'relationship' => 'votingapi_cache',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'article' => 'article',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '0' => '2',
      '1' => '112',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'textfield',
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 0,
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('footer', 'Check out the Manitoban\'s <a href="/themanitoban/bests">Alltime Bests of All Time</a>');
$handler->override_option('footer_format', '3');
$handler->override_option('footer_empty', 1);
$handler->override_option('items_per_page', 5);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'grouping' => '',
  'type' => 'ol',
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);

i was using the most recent version of votingAPI and Views until new versions came out of them. now i'm using the current recommended releases. i basically just try to always have the recommended releases of projects.
thanks!

justinchev’s picture

Similar problem - using views to order a list of Five star items, just updated to the latest version of VotingAPI (6.x-2.0-rc1) and it's now not working.

In the View setup under Relationship and Sort Criteria nothing appears relating to VotingAPI . Under Relationship and Sort Criteria there is now an error reading - Broken/missing handler.

The previous working version was 6.x-2.0-beta6.

eaton’s picture

Do you have the latest version of Views?

justinchev’s picture

The last version of views I tried broke my site completely. I see there is a newer version than the one that broke my site will try that...

OK, changing both the Views and VotingAPI modules for the latest release has fixed it.

Thanks for your help.

lefnire’s picture

I think this could be a usability feature-request.

in votingapi 5.x, I didn't have to read instructions. I just set up a view with an "average vote" field. no-brainer.

in votingapi 6x-2.0, I came across the issue, thought it was a bug. Read the README.TXT front to back a couple times, and finally chanced upon this thread. After reading every comment in this thread, I sat there tweaking the "Node: Voting results" Relationship and adding different Votingapi fields until it finally worked.

just a suggestion to make a bit simpler for the typical end-user

eaton’s picture

Status: Active » Closed (fixed)

Unfortunately, I'm not sure how likely that is. I'd suggest taking a look at the issue queue for the Drupal 5 version of VotingAPI's Views integration -- there's a small set of cases where it DOES work properly, and a huge number of cases where it simply explodes and makes a mess due to the tricky workarounds it employs to make things "kind of automatic".

I understand that the additional step of adding a relationship is, well, another step, but for the time being it's necessary. It's an officially supported aspect of Views2, not an ugly hack, and in contrast with Drupal 5's integration, it actually works.

The latest release of VotingAPI includes three sample views to demonstrate how the fields work. I'll be updating the README.txt with more explicit instructions, and I'll also be adding support for the Advanced Help module to provide inline help inside the Views UI.

If there are some specific improvements that can be suggested that won't break things in multiple configurations, I'm definitely interested in hearing ideas. Please start new feature requests issues for them, though, as it helps keep them separate from explicit bug reports about the current Views integration code. Thanks!

kevindoole’s picture

In reply to my last post where nothing was working:
it may have been something i had done, but you may be interested to know (maybe?) that the problem was caused because my votingAPI_cache table had crashed. i emptied that table and now everything seems to be working again.

thanks for your support!
and hopefully/probably this was just a result of moving my site around.

thanks

egarias’s picture

Version: 6.x-2.x-dev » 6.x-2.3
Component: Code » Views Integration

I have a site: http://solomoto.es where users can vote to articles using fivestar.
I have a block with highest rating articles (+Votado on left sidebar with tabs). but I am unable to show the total votes, the output is 100 in all the nodes.
I am using views 6.2.8 and votingapi 6.2.3.

Here the code of my view:

$view = new view;
$view->name = 'top_content_taxonomy';
$view->description = 'Top rated content by taxonomy';
$view->tag = 'votingapi';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
  'votingapi_cache' => array(
    'label' => 'Vote results',
    'required' => 1,
    'votingapi' => array(
      'value_type' => 'percent',
      'tag' => 'vote',
      'function' => 'average',
    ),
    'id' => 'votingapi_cache',
    'table' => 'node',
    'field' => 'votingapi_cache',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'nid' => array(
    'label' => 'Domain node',
    'required' => 1,
    'id' => 'nid',
    'table' => 'domain_access',
    'field' => 'nid',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'set_precision' => 0,
    'precision' => '0',
    'decimal' => '.',
    'separator' => ',',
    'prefix' => '',
    'suffix' => 'Votos',
    'appearance' => '',
    'exclude' => 0,
    'id' => 'value',
    'table' => 'votingapi_cache',
    'field' => 'value',
    'relationship' => 'votingapi_cache',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('sorts', array(
  'value' => array(
    'order' => 'DESC',
    'id' => 'value',
    'table' => 'votingapi_cache',
    'field' => 'value',
    'relationship' => 'votingapi_cache',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('arguments', array(
  'name' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Todos',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'glossary' => 0,
    'limit' => '0',
    'case' => 'none',
    'path_case' => 'none',
    'transform_dash' => 0,
    'add_table' => 0,
    'require_value' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '7' => 0,
      '5' => 0,
      '4' => 0,
      '6' => 0,
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'blog' => 0,
      'ad' => 0,
      'multichoice' => 0,
      'long_answer' => 0,
      'matching' => 0,
      'quiz_directions' => 0,
      'true_false' => 0,
      'short_answer' => 0,
      'quiz' => 0,
      'panel' => 0,
      'articulo' => 0,
      'audio' => 0,
      'date' => 0,
      'event' => 0,
      'feed' => 0,
      'feeditem' => 0,
      'op_image' => 0,
      'package' => 0,
      'page' => 0,
      'resource' => 0,
      'simplenews' => 0,
      'topichub' => 0,
      'twitter_item' => 0,
      'video' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '44' => 0,
      '1' => 0,
      '40' => 0,
      '43' => 0,
      '2' => 0,
      '3' => 0,
      '4' => 0,
      '5' => 0,
      '6' => 0,
      '7' => 0,
      '8' => 0,
      '41' => 0,
      '9' => 0,
      '10' => 0,
      '11' => 0,
      '12' => 0,
      '13' => 0,
      '14' => 0,
      '15' => 0,
      '16' => 0,
      '17' => 0,
      '18' => 0,
      '19' => 0,
      '20' => 0,
      '45' => 0,
      '21' => 0,
      '22' => 0,
      '23' => 0,
      '24' => 0,
      '25' => 0,
      '26' => 0,
      '27' => 0,
      '28' => 0,
      '29' => 0,
      '30' => 0,
      '31' => 0,
      '32' => 0,
      '33' => 0,
      '34' => 0,
      '35' => 0,
      '36' => 0,
      '37' => 0,
      '38' => 0,
      '39' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_node_flag_name' => '*relationship*',
    'validate_argument_node_flag_test' => 'flaggable',
    'validate_argument_node_flag_id_type' => 'id',
    'validate_argument_user_flag_name' => '*relationship*',
    'validate_argument_user_flag_test' => 'flaggable',
    'validate_argument_user_flag_id_type' => 'id',
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => 1,
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'current_all' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'current_all',
    'table' => 'domain_access',
    'field' => 'current_all',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'nid',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'articulo' => 'articulo',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Top rated content');
$handler->override_option('items_per_page', 6);
$handler->override_option('use_pager', '0');
$handler->override_option('style_plugin', 'list');
$handler = $view->new_display('block', 'Top content taxonomy', 'block_1');
$handler->override_option('block_description', 'Top content taxonomy');
$handler->override_option('block_caching', -1);

Thanks in advance for any help