Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.6
Component:
page displays
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Nov 2009 at 16:26 UTC
Updated:
27 Nov 2009 at 18:50 UTC
In one of my views, I have content duplicating after adding the field 'Comment Posted Date'. Here is my code. Any suggestions or help is greatly appreciated.
$view = new view;
$view->name = 'Blog_Surrette';
$view->description = 'Blog - Surrette';
$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('relationships', array(
'nid' => array(
'id' => 'nid',
'table' => 'comments',
'field' => 'nid',
),
'votingapi_cache' => array(
'label' => 'Vote results',
'required' => 0,
'votingapi' => array(
'value_type' => 'percent',
'tag' => 'vote',
'function' => 'average',
),
'id' => 'votingapi_cache',
'table' => 'node',
'field' => 'votingapi_cache',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'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',
'relationship' => 'none',
),
'name' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 1,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
'created' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'date_format' => 'custom',
'custom_date_format' => 'm/d/y',
'exclude' => 0,
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
),
'body' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'relationship' => 'none',
),
'value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'set_precision' => 0,
'precision' => '0',
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'appearance' => 'fivestar_views_widget_compact_handler',
'exclude' => 0,
'id' => 'value',
'table' => 'votingapi_cache',
'field' => 'value',
'relationship' => 'votingapi_cache',
),
'node_link' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'teaser' => 0,
'exclude' => 0,
'id' => 'node_link',
'table' => 'comments',
'field' => 'node_link',
'relationship' => 'none',
),
'name_1' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => 0,
'exclude' => 0,
'id' => 'name_1',
'table' => 'comments',
'field' => 'name',
'relationship' => 'none',
),
'timestamp' => array(
'label' => 'Posted',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'timestamp',
'table' => 'comments',
'field' => 'timestamp',
'relationship' => 'none',
),
'comment' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'exclude' => 0,
'id' => 'comment',
'table' => 'comments',
'field' => 'comment',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'timestamp' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'timestamp',
'table' => 'node_revisions',
'field' => 'timestamp',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'term_node_tid_depth' => array(
'default_action' => 'empty',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '%1\'s Blog',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'taxonomy_term',
'validate_fail' => 'empty',
'depth' => '0',
'break_phrase' => 0,
'set_breadcrumb' => 0,
'id' => 'term_node_tid_depth',
'table' => 'node',
'field' => 'term_node_tid_depth',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'3' => 0,
'4' => 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(
'blog' => 0,
'forum' => 0,
'panel' => 0,
'book' => 0,
'document_listing' => 0,
'page' => 0,
'solutions_overview' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'9' => 9,
'1' => 0,
'8' => 0,
'3' => 0,
'5' => 0,
'7' => 0,
'2' => 0,
'4' => 0,
'6' => 0,
),
'validate_argument_type' => 'tids',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
'term_node_tid_depth_modifier' => array(
'id' => 'term_node_tid_depth_modifier',
'table' => 'node',
'field' => 'term_node_tid_depth_modifier',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'blog' => 'blog',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('empty', 'No blog entries.');
$handler->override_option('empty_format', '1');
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 1);
$handler->override_option('row_options', array(
'inline' => array(
'name_1' => 'name_1',
'timestamp' => 'timestamp',
),
'separator' => ' ',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'blogs');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comments
Comment #1
merlinofchaos commentedYes, that field will provide the post date for every comment attached to the node. That will cause duplicates.