Project:Views attach
Version:6.x-2.2
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I created a Node Content display type and set the Default Argument to be a Token for a CCK field (field "a"). I then created an argument for a field on a different content type (field "b"). I would expect this to display all nodes where field "b" has the same value as field "a" in the original node. Instead, it seems to be displaying all nodes where field "b" has the same value as the NID of the original node.

Comments

#1

We could not replicate this error. Please provide an export of your views. Thanks!

#2

Upon further inspection, something screwy is definitely going on, but I'm not sure it's exactly what I described. Basically, the View works fine on some nodes but not others. I can't make out any pattern to it, and I suspect it's possibly a problem with another module. Can you think of a quick way to test if Views_attach is working - i.e., force the View to simply print out the Token data?

$view = new view;
$view->name = 'userpubs';
$view->description = 'User\'s Publications';
$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('fields', array(
  'title' => array(
    'label' => 'Title',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'drupal_uid' => array(
    'default_action' => 'not found',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'drupal_uid',
    'table' => 'biblio_contributor_data',
    'field' => 'drupal_uid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '5' => 0,
      '4' => 0,
      '7' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'biblio' => 0,
      'book' => 0,
      'internal' => 0,
      'page' => 0,
      'profile' => 0,
      'project' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '2' => 0,
      '3' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'biblio' => 'biblio',
    ),
    '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 = $view->new_display('node_content', 'Node content', 'node_content_1');
$handler->override_option('types', array(
  'profile' => 'profile',
));
$handler->override_option('modes', array(
  '0' => 'full',
));
$handler->override_option('default_argument', '[field_user_id-raw]');

#3

Actually I have determined that the problem is specific to certain Member profile nodes, and not to particular values of [field_user_id-raw]. This leads me to believe that it might indeed be a problem with Views_attach.

#4

Ah- I believe I have figured it out. Views_attach is only using the first character of the NID for some reason.

#5

Here is the patch:

AttachmentSize
views_attach-485832.patch 3.41 KB

#6

Status:active» needs review

#7

Status:needs review» reviewed & tested by the community

Patch works great! Thanks for the swift response.

#8

Yes it works for me too!

#9

Patch worked great here.

#10

Works for me too. I think this is a bug of critical priority, since this makes views_attach not work if you have more than 9 nodes =P.

#11

Priority:normal» critical

#12

Version:6.x-2.0» 6.x-2.x-dev
Status:reviewed & tested by the community» fixed

Committed. Thanks all!

#13

Status:fixed» closed (fixed)

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

#14

Version:6.x-2.x-dev» 6.x-2.2
Status:closed (fixed)» active

Hi,

I suppose that 6.x.2.2 has this fix. Am I right?

It seems not work in my view. My view is very simple. Content type A has a node reference (CCK field). I then create a view and add Content Node display with token(field_fieldname_nid). The argument of the view is nid. The result is that the EMPTY TXT was showed.

Can anyone clarify for me? Do I need to use 2.x-dev?

Thanks.

hosais

#15

Status:active» closed (fixed)

I don't follow what you're trying to do. Please open a new ticket rather than reopening a long-closed one, including what you're trying to do, where you're putting the view, and what the content types involved are.

#16

Thanks for your quick reply.

I made some more tests and post at http://drupal.org/node/1252960.

hosais

nobody click here