Fivestar ratings *almost* working through views (NE GiveCamp wrap up)

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
morisy's picture

We're trying to implement a Q&A side for our news site, and got through 95%-ish of it this weekend at GiveCamp following this tutorial, but I'm running into problems getting the fivestar to save the rating properly ... I think I've messed up the relationship somehow but I can't figure what gives.

The site is live on our dev, and everything looks perfect except that if you click one of the rating options, you get the following:

warning: Missing argument 4 for fivestar_vote() in /home/leon/public_html/dev/modules/fivestar/fivestar.module on line 688.

The ratings actually apply to another node(s), content type answers, that are shown on that page via a views attachment.

Here's the code of the view:

$view = new view;
$view->name = 'faq';
$view->description = 'FAQ section';
$view->tag = '';
$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(
  'field_answer_nid' => array(
    'label' => '',
    'required' => 1,
    'delta' => -1,
    'id' => 'field_answer_nid',
    'table' => 'node_data_field_answer',
    'field' => 'field_answer_nid',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'votingapi_vote' => array(
    'label' => 'Votes',
    'required' => 0,
    'votingapi' => array(
      'value_type' => '',
      'tag' => '',
    ),
    'current_user' => 0,
    'id' => 'votingapi_vote',
    'table' => 'node',
    'field' => 'votingapi_vote',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'body' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'exclude' => 1,
    'id' => 'body',
    'table' => 'node_revisions',
    'field' => 'body',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'created' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'date_format' => 'time ago',
    'custom_date_format' => '',
    'exclude' => 1,
    'id' => 'created',
    'table' => 'node',
    'field' => 'created',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'name' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 1,
      'text' => '[name] answered:
<blockquote>[body]</blockquote>',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_user' => 1,
    'overwrite_anonymous' => 1,
    'anonymous_text' => 'A site visitor',
    'exclude' => 0,
    'id' => 'name',
    'table' => 'users',
    'field' => 'name',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'value' => array(
    'label' => 'How good was this answer?',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'set_precision' => 0,
    'precision' => '0',
    'decimal' => '.',
    'separator' => ',',
    'prefix' => '',
    'suffix' => '',
    'appearance' => 'fivestar_views_widget_compact_handler',
    'exclude' => 0,
    'id' => 'value',
    'table' => 'votingapi_vote',
    'field' => 'value',
    'relationship' => 'votingapi_vote',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('arguments', array(
  'nid' => array(
    'default_action' => 'not found',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '%1',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'node',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'nid',
    'table' => 'node',
    'field' => 'nid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '7' => 0,
      '10' => 0,
      '6' => 0,
      '11' => 0,
      '9' => 0,
      '4' => 0,
      '3' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => '',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    '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',
    'image_size' => array(
      '_original' => '_original',
      'thumbnail' => 'thumbnail',
      'preview' => 'preview',
    ),
    'validate_argument_node_type' => array(
      'question' => 'question',
      'ad' => 0,
      'image' => 0,
      'poll' => 0,
      'panel' => 0,
      'answer' => 0,
      'blog' => 0,
      'burningquestion' => 0,
      'communityresponse' => 0,
      'event' => 0,
      'organization' => 0,
      'page' => 0,
      'photo' => 0,
      'profile' => 0,
      'resources' => 0,
      'story' => 0,
      'uprofile' => 0,
      'vendor' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '9' => 0,
      '10' => 0,
      '6' => 0,
      '5' => 0,
      '8' => 0,
      '11' => 0,
      '1' => 0,
      '4' => 0,
      '7' => 0,
      '2' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    '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',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'answer' => 'answer',
    ),
    '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('empty', 'There are no answers yet! Click above to add your own.');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'desc',
  'columns' => array(
    'body' => 'body',
    'created' => 'created',
    'name' => 'name',
    'value' => 'value',
  ),
  'info' => array(
    'body' => array(
      'separator' => '',
    ),
    'created' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'name' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'value' => array(
      'sortable' => 1,
      'separator' => '',
    ),
  ),
  'default' => 'value',
));
$handler->override_option('row_options', array(
  'inline' => array(),
  'separator' => '',
  'hide_empty' => 0,
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('relationships', array());
$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',
  ),
));
$handler->override_option('title', 'Question:');
$handler->override_option('items_per_page', 1);
$handler->override_option('style_plugin', 'default');
$handler->override_option('style_options', array());
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'relationship' => 'none',
  'build_mode' => 'full',
  'links' => 1,
  'comments' => 1,
));
$handler->override_option('path', 'question/%');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler = $view->new_display('attachment', 'Attachment', 'attachment_2');
$handler->override_option('relationships', array(
  'field_answer_nid' => array(
    'label' => '',
    'required' => 1,
    'delta' => -1,
    'id' => 'field_answer_nid',
    'table' => 'node_data_field_answer',
    'field' => 'field_answer_nid',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'votingapi_vote' => array(
    'label' => 'Votes',
    'required' => 1,
    'votingapi' => array(
      'value_type' => 'points',
      'tag' => 'vote',
    ),
    'current_user' => 0,
    'id' => 'votingapi_vote',
    'table' => 'node',
    'field' => 'votingapi_vote',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'field_answer_nid' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'node',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'field_answer_nid',
    'table' => 'node_data_field_answer',
    'field' => 'field_answer_nid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '7' => 0,
      '10' => 0,
      '6' => 0,
      '11' => 0,
      '9' => 0,
      '4' => 0,
      '3' => 0,
    ),
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => '',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    'image_size' => array(
      '_original' => '_original',
      'thumbnail' => 'thumbnail',
      'preview' => 'preview',
    ),
    'validate_argument_node_type' => array(
      'ad' => 0,
      'image' => 0,
      'poll' => 0,
      'panel' => 0,
      'answer' => 0,
      'blog' => 0,
      'burningquestion' => 0,
      'communityresponse' => 0,
      'event' => 0,
      'organization' => 0,
      'page' => 0,
      'photo' => 0,
      'profile' => 0,
      'question' => 0,
      'resources' => 0,
      'story' => 0,
      'uprofile' => 0,
      'vendor' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '9' => 0,
      '10' => 0,
      '6' => 0,
      '5' => 0,
      '8' => 0,
      '11' => 0,
      '1' => 0,
      '4' => 0,
      '7' => 0,
      '2' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', FALSE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'page_1' => 'page_1',
  'default' => 0,
));

Newspapers on Drupal

Group organizers

Group categories

Topics - Newspaper on Drupal

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week