Views support: when sorting by role weights a node appears three times.

Bèr Kessels - May 17, 2006 - 15:21
Project:Role Weights
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Something is broken in the role wights table. when sorting by role weights a node appears three times. This ususally indicates the $table returns something erronous. Resulting in a strange JOIN query built by views module.

#1

leafish_paul - May 17, 2006 - 19:40

Can you provide your view? I can't reproduce this here.

#2

Bèr Kessels - May 18, 2006 - 13:31

http://incubator.beauty-coach.nl/vacatures/alle

  $view = new stdClass();
  $view->name = 'Vacatures';
  $view->description = 'Vacatures';
  $view->access = array (
);
  $view->page = TRUE;
  $view->page_title = 'Vacatures';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_type = 'teaser';
  $view->url = 'vacatures/alle';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->block = TRUE;
  $view->block_title = '';
  $view->block_header = '';
  $view->block_header_format = '1';
  $view->block_type = 'teaser';
  $view->nodes_per_block = '0';
  $view->block_more = '0';
  $view->block_use_page_header = FALSE;
  $view->sort = array (
    array (
      'tablename' => 'node',
      'field' => 'sticky',
      'sortorder' => 'ASC',
      'options' => '',
    ),
    array (
      'tablename' => 'role_weights',
      'field' => 'weight',
      'sortorder' => 'ASC',
      'options' => '',
    ),
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => '',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'taxletter',
      'argdefault' => '2',
      'title' => 'Vacatures: %1',
      'options' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
    ),
    array (
      'tablename' => 'term_node_9',
      'field' => 'name',
      'label' => '',
    ),
    array (
      'tablename' => 'term_node_8',
      'field' => 'name',
      'label' => '',
    ),
    array (
      'tablename' => 'term_node_14',
      'field' => 'name',
      'label' => '',
    ),
    array (
      'tablename' => 'term_node_7',
      'field' => 'name',
      'label' => '',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'content-vacature',
),
    ),
    array (
      'tablename' => 'node',
      'field' => 'moderate',
      'operator' => '=',
      'options' => '',
      'value' => '0',
    ),
    array (
      'tablename' => 'term_node_9',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_11',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_7',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_8',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_14',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
  );
  $view->requires = array(node, role_weights, term_node_9, term_node_8, term_node_14, term_node_7, term_node_11);
  $views[$view->name] = $view;

#3

leafish_paul - January 30, 2007 - 01:07

Any luck with this and more recent versions of Views, Bèr?

#4

leafish_paul - February 27, 2008 - 23:38
Title:views table bug: when sorting by role weights a node appears three times.» Views support: when sorting by role weights a node appears three times.
Status:active» postponed (maintainer needs more info)

#5

dharmanerd - October 31, 2008 - 22:52

Check your join type or add a group by. My view was outputting a node for each row in the role weights table.

#6

leafish_paul - April 3, 2009 - 09:35
Version:HEAD» 5.x-1.x-dev

#7

leafish_paul - June 9, 2009 - 20:18
Status:postponed (maintainer needs more info)» active

Yep, this problem occurs when a user has more than one role, present in 5.x & 6.x/HEAD.

#8

czeky - September 9, 2009 - 20:52

Hi, any solution for this? I need to use more roles for the user, but I need it to appear in a Views listing just once.. thanx

#9

czeky - September 16, 2009 - 21:33

Anyone? thank You

 
 

Drupal is a registered trademark of Dries Buytaert.