I have a references view which seems to retrieve the wrong node as it's supposed to. I'm using the references view to limit the choice of parent nodes available to a user when a child node is saved. The child node has a node reference which the view finds with a reverse relationship, but the node that shows up in the view preview isn't the one being saved when the new node is created. Easier to explain it this way:

My setup (and steps to reproduce):
- Family custom content type
- On Users, user ref field called field_user_family (points to Family content type)
- Parent content type with node ref field_family
- A References view (attached below) which finds Parents based on the logged in user's Family
- Child content type with node ref field_parent. The References View is attached to this field.

Desired behavior:
- Every user belongs to a Family
- The logged in User can create Child nodes, but the Parents available under field_parent are determined by the Reference View. That way, a User can only add Child nodes to the Family he/she belongs to.

The problem:
When a User is on the Add Node page to add a Child node, the Reference View properly displays only the Parents in the Family node that the logged in user belongs to (see screenshot 1). The node saves properly, but on the next page, the Family node is shown, not the Parent (see screenshot 2 - Family node in this case is called 'smiths').

So basically, the References View is displaying the correct node to be referenced, but saving the wrong node as a node reference!

Is this a bug, or is me using the a reverse relationship in my view incorrectly?

Thanks! The View export is here:

$view = new view;
$view->name = 'parent_per_family_per_user';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'parent per family per user';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Content: Family (field_user_family) - reverse */
$handler->display->display_options['relationships']['reverse_field_user_family_user']['id'] = 'reverse_field_user_family_user';
$handler->display->display_options['relationships']['reverse_field_user_family_user']['table'] = 'node';
$handler->display->display_options['relationships']['reverse_field_user_family_user']['field'] = 'reverse_field_user_family_user';
$handler->display->display_options['relationships']['reverse_field_user_family_user']['required'] = 0;
/* Relationship: User: Family (field_user_family) */
$handler->display->display_options['relationships']['field_user_family_nid']['id'] = 'field_user_family_nid';
$handler->display->display_options['relationships']['field_user_family_nid']['table'] = 'field_data_field_user_family';
$handler->display->display_options['relationships']['field_user_family_nid']['field'] = 'field_user_family_nid';
$handler->display->display_options['relationships']['field_user_family_nid']['relationship'] = 'reverse_field_user_family_user';
$handler->display->display_options['relationships']['field_user_family_nid']['label'] = 'field_user_family_not_reversed';
$handler->display->display_options['relationships']['field_user_family_nid']['required'] = 0;
$handler->display->display_options['relationships']['field_user_family_nid']['delta'] = '-1';
/* Relationship: Content: Family (field_family) - reverse */
$handler->display->display_options['relationships']['reverse_field_family_node']['id'] = 'reverse_field_family_node';
$handler->display->display_options['relationships']['reverse_field_family_node']['table'] = 'node';
$handler->display->display_options['relationships']['reverse_field_family_node']['field'] = 'reverse_field_family_node';
$handler->display->display_options['relationships']['reverse_field_family_node']['required'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['relationship'] = 'reverse_field_family_node';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Content: Type */
$handler->display->display_options['fields']['type']['id'] = 'type';
$handler->display->display_options['fields']['type']['table'] = 'node';
$handler->display->display_options['fields']['type']['field'] = 'type';
$handler->display->display_options['fields']['type']['relationship'] = 'reverse_field_family_node';
$handler->display->display_options['fields']['type']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['type']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['type']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['type']['alter']['external'] = 0;
$handler->display->display_options['fields']['type']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['type']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['type']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['type']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['type']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['type']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['type']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['type']['alter']['trim'] = 0;
$handler->display->display_options['fields']['type']['alter']['html'] = 0;
$handler->display->display_options['fields']['type']['element_label_colon'] = 1;
$handler->display->display_options['fields']['type']['element_default_classes'] = 1;
$handler->display->display_options['fields']['type']['hide_empty'] = 0;
$handler->display->display_options['fields']['type']['empty_zero'] = 0;
$handler->display->display_options['fields']['type']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['type']['link_to_node'] = 0;
$handler->display->display_options['fields']['type']['machine_name'] = 0;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: User: Uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'users';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['relationship'] = 'reverse_field_user_family_user';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['uid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['uid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['uid']['not'] = 0;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

/* Display: References */
$handler = $view->new_display('references', 'References', 'references_1');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'references_style';
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'references_fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
CommentFileSizeAuthor
screenshot_2.jpg135.65 KBjbucks
screenshot_1.jpg143.07 KBjbucks
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MustangGB’s picture

Status: Active » Closed (outdated)

Closing this as outdated to tidy up a bit around here. If you're still having problems with the latest release please create a new issue.