I have a Rating Field on my node. I tried adding the same field and different rating fields to my comments, but I never get the option for a Voting Target (as I wish to target the parent node). I check the field.inc and the code the Voting Target is there, but it just won't display for me. I'm sure I'm missing something simple, so I'd appreciate any advice/help.

I tested this in Beta 2 and Dev.

Thanks so much,
Michael

Comments

InTheLyonsDen’s picture

Title: Voting Target not showing up at all » Voting Target / Node Reference setting is missing - not showing up at all
Priority: Normal » Major

I just installed and tested both the current dev and alpha versions and the "Voting target" for the node_reference field form options are missing. I have an Item and Review content types built with a working node reference between them. I added Fivestar and the only option is to select the term. I am looking through older commits to see if it was lost. Please help... launching a site this week that is dependent on this functionality.

I did find a reference to the menu item in fivestar.field.inc in a commit back in July (http://drupalcode.org/project/fivestar.git/blob/HEAD:/includes/fivestar....) This code is not in the current version. I tried "throwing it in" but it's a little above my skill level.

 $dynamic_options = array();
  46   if (module_exists('node_reference')) {
  47     $fields = field_info_fields();
  48     foreach ($fields as $field_name => $content_field) {
  49       // Make sure that this field exists for this type.
  50       if ($content_field['type'] == 'node_reference' && in_array($field['bundles'][$instance['entity_type']][0], $content_field['bundles']['node'])) {
  51         $dynamic_options[$content_field['field_name']] = t('Node reference: @field', array('@field' => $content_field['field_name']));
  52       }
  53     }
  54   }
  55   if ($instance['entity_type'] == 'comment') {
  56     $dynamic_options['parent_node'] = t('Parent Node');
  57   }
  58 
  59   if (empty($dynamic_options)) {
  60     drupal_set_message(t('No potential target fields are available for the %type bundle. Create a node reference field in this bundle to make it easier to assign a vote to a node.', array('%type' => $instance['bundle'])), 'warning');
  61   }
ericduran’s picture

This should be in the latest dev.

You need to have the node reference field already created. Do you have a reference field created already?

If so when you do then go back to the fivestar field and you should get the option.

InTheLyonsDen’s picture

Yep. Node Reference (latest dev version of references) is created and working with content on it. Fivestar added to content type. No menu item. I also tried removing the node reference field added fivestar then re-added the node reference.

Please tell me I'm missing something... :) I added screenshots of all menues.

ericduran’s picture

Try changing the nodereference widget type. I notice you have from url. When I wrote the functionality that wasn't an avialable option. Try using one of the basic widgets see if that works?

InTheLyonsDen’s picture

You had me excited... but no go. I switched the widget type and nada. I then deleted both the node reference and fivestar fields, re created node reference and fivestar using basic widget settings and nothing.

InTheLyonsDen’s picture

Just for kicks ( I don't want to use comments for reviews) I added a fivestar field to comments and I am not seeing the option to set to 'parent' target.

I'm using current dev releases for references, votingapi, and fivestar.

ericduran’s picture

Ok, checking this out right now.

ericduran’s picture

Actually I just notice you have the rated while viewing fivestar widget. That widget doesn't support reference because that would be a weird UI experience for the user. If you want the vote to target another vote you need to use the "Rated (while editing) widget"

InTheLyonsDen’s picture

You are a genius! That is about the only option I had not fidgeted with. Hmmm... it also exposed the "STAR DISPLAY OPTIONS" in the edit box. I had been setting them in the field display.

So... want to go 2 for 2? :)

#1399800: Need to Import 9k Votes - Votingapi_cache not being rebuilt
-or-
#1268658: Fivestar support

I need to import bunches of votes that are attached to views and Firestar isn't playing nice with Feeds.

Thanks again!

ericduran’s picture

@InTheLyonsDen would you like to help out a bit? And write a documentation page on setting up a node reference ;-) ?

Energyblazar’s picture

Hello,

What should i do if i want the fivestar to target the parent (content type) and also reference is to profile 2 (nodereference / User reference / Entity Reference anything will work for me)

Any clues ?

ericduran’s picture

Status: Active » Fixed

@Energyblazar create a new issue, I'll help you out there. But in short I only wrote references for node and user reference. I didn't write any for profile2 but I can.

The original support request has already been fixed. I'll follow up on new issues.

Energyblazar’s picture

Thanks ericduran..... here is link to the new issue that i created .... http://drupal.org/node/1481502

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.