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.

CommentFileSizeAuthor
#5 views_attach-485832.patch3.41 KBeabrand

Comments

eabrand’s picture

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

danepowell’s picture

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]');
danepowell’s picture

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.

danepowell’s picture

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

eabrand’s picture

StatusFileSize
new3.41 KB

Here is the patch:

eabrand’s picture

Status: Active » Needs review
danepowell’s picture

Status: Needs review » Reviewed & tested by the community

Patch works great! Thanks for the swift response.

anrikun’s picture

Yes it works for me too!

johnthomas00’s picture

Patch worked great here.

jackbravo’s picture

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.

danepowell’s picture

Priority: Normal » Critical
Crell’s picture

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

Committed. Thanks all!

Status: Fixed » Closed (fixed)

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

hosais’s picture

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

Crell’s picture

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.

hosais’s picture

Thanks for your quick reply.

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

hosais