Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updating for clarity:
The functional issue here has remained the same, but the patches posted below have resolved the associated error messages.
When using the argument "Content: User posted or commented" --
Expected behavior
Views displays content authored by the currently logged in user and content commented on by the currently logged in user.
Actual Behavior
Views displays content authored by the currently logged in user and all content from the author of the post commented on by the currently logged in user.
Comment | File | Size | Author |
---|---|---|---|
#55 | 972934-user-posted_comment-alias.patch | 1.54 KB | dawehner |
#54 | view_export_comment_tracker.txt | 6.53 KB | Ate_f |
#26 | 972934-fix-2.patch | 1.34 KB | neopoet |
#25 | 972934-easyfix.patch | 1.31 KB | neopoet |
#21 | 972934-desperate-try.patch | 3.07 KB | dawehner |
Comments
Comment #1
neopoet CreditAttribution: neopoet commentedThis is a major issue for us -- we'd appreciate any help. Thank you!
Comment #2
dawehnerWhen you don't even export a view i somehow guess that the issue isn't that important.
Sadly i can reproduce the bug.
Comment #3
neopoet CreditAttribution: neopoet commentedDereine,
Thanks for reading. Here's an export of one of the views that does not work as intended:
----
$view = new view;
$view->name = 'missedupdates2';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'type' => 'type',
'timestamp' => 'timestamp',
'new_comments' => 'new_comments',
'created' => 'created',
'status' => 'status',
'title' => 'title',
'type_1' => 'type_1',
'changed' => 'changed',
'last_updated' => 'last_updated',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'type' => array(
'sortable' => 0,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
),
'timestamp' => array(
'align' => '',
'separator' => '',
),
'new_comments' => array(
'align' => '',
'separator' => '',
),
'created' => array(
'sortable' => 0,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
),
'status' => array(
'sortable' => 0,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
),
'title' => array(
'sortable' => 0,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
),
'type_1' => array(
'sortable' => 0,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
),
'changed' => array(
'sortable' => 0,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
),
'last_updated' => array(
'sortable' => 0,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
),
);
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
/* Field: Node: 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']['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']['trim'] = 0;
$handler->display->display_options['fields']['type']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['type']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['type']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['type']['alter']['html'] = 0;
$handler->display->display_options['fields']['type']['empty'] = 'test';
$handler->display->display_options['fields']['type']['hide_empty'] = 0;
$handler->display->display_options['fields']['type']['empty_zero'] = 0;
$handler->display->display_options['fields']['type']['link_to_node'] = 0;
$handler->display->display_options['fields']['type']['machine_name'] = 0;
/* Field: Node: Has new content */
$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['table'] = 'history';
$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['trim'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['html'] = 0;
$handler->display->display_options['fields']['timestamp']['hide_empty'] = 0;
$handler->display->display_options['fields']['timestamp']['empty_zero'] = 0;
$handler->display->display_options['fields']['timestamp']['link_to_node'] = 1;
$handler->display->display_options['fields']['timestamp']['comments'] = 0;
/* Field: Node: New comments */
$handler->display->display_options['fields']['new_comments']['id'] = 'new_comments';
$handler->display->display_options['fields']['new_comments']['table'] = 'node';
$handler->display->display_options['fields']['new_comments']['field'] = 'new_comments';
$handler->display->display_options['fields']['new_comments']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['trim'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['html'] = 0;
$handler->display->display_options['fields']['new_comments']['hide_empty'] = 0;
$handler->display->display_options['fields']['new_comments']['empty_zero'] = 0;
$handler->display->display_options['fields']['new_comments']['format_plural'] = 0;
$handler->display->display_options['fields']['new_comments']['link_to_comment'] = 1;
/* Field: Node: Post date */
$handler->display->display_options['fields']['created']['id'] = 'created';
$handler->display->display_options['fields']['created']['table'] = 'node';
$handler->display->display_options['fields']['created']['field'] = 'created';
$handler->display->display_options['fields']['created']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['created']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['created']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['created']['alter']['trim'] = 0;
$handler->display->display_options['fields']['created']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['created']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['created']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['created']['alter']['html'] = 0;
$handler->display->display_options['fields']['created']['hide_empty'] = 0;
$handler->display->display_options['fields']['created']['empty_zero'] = 0;
/* Field: Node: Published */
$handler->display->display_options['fields']['status']['id'] = 'status';
$handler->display->display_options['fields']['status']['table'] = 'node';
$handler->display->display_options['fields']['status']['field'] = 'status';
$handler->display->display_options['fields']['status']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['status']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['status']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['status']['alter']['trim'] = 0;
$handler->display->display_options['fields']['status']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['status']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['status']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['status']['alter']['html'] = 0;
$handler->display->display_options['fields']['status']['hide_empty'] = 0;
$handler->display->display_options['fields']['status']['empty_zero'] = 0;
$handler->display->display_options['fields']['status']['not'] = 0;
/* Field: Node: 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']['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']['trim'] = 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']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Node: Type */
$handler->display->display_options['fields']['type_1']['id'] = 'type_1';
$handler->display->display_options['fields']['type_1']['table'] = 'node';
$handler->display->display_options['fields']['type_1']['field'] = 'type';
$handler->display->display_options['fields']['type_1']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['type_1']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['type_1']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['type_1']['alter']['trim'] = 0;
$handler->display->display_options['fields']['type_1']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['type_1']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['type_1']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['type_1']['alter']['html'] = 0;
$handler->display->display_options['fields']['type_1']['hide_empty'] = 0;
$handler->display->display_options['fields']['type_1']['empty_zero'] = 0;
$handler->display->display_options['fields']['type_1']['link_to_node'] = 1;
$handler->display->display_options['fields']['type_1']['machine_name'] = 0;
/* Field: Node: Updated date */
$handler->display->display_options['fields']['changed']['id'] = 'changed';
$handler->display->display_options['fields']['changed']['table'] = 'node';
$handler->display->display_options['fields']['changed']['field'] = 'changed';
$handler->display->display_options['fields']['changed']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['changed']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['changed']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['changed']['alter']['trim'] = 0;
$handler->display->display_options['fields']['changed']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['changed']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['changed']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['changed']['alter']['html'] = 0;
$handler->display->display_options['fields']['changed']['hide_empty'] = 0;
$handler->display->display_options['fields']['changed']['empty_zero'] = 0;
$handler->display->display_options['fields']['changed']['date_format'] = 'time ago';
/* Field: Node: Updated/commented date */
$handler->display->display_options['fields']['last_updated']['id'] = 'last_updated';
$handler->display->display_options['fields']['last_updated']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['last_updated']['field'] = 'last_updated';
$handler->display->display_options['fields']['last_updated']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['last_updated']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['last_updated']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['last_updated']['alter']['trim'] = 0;
$handler->display->display_options['fields']['last_updated']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['last_updated']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['last_updated']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['last_updated']['alter']['html'] = 0;
$handler->display->display_options['fields']['last_updated']['hide_empty'] = 0;
$handler->display->display_options['fields']['last_updated']['empty_zero'] = 0;
/* Argument: Node: User posted or commented */
$handler->display->display_options['arguments']['uid_touch']['id'] = 'uid_touch';
$handler->display->display_options['arguments']['uid_touch']['table'] = 'node';
$handler->display->display_options['arguments']['uid_touch']['field'] = 'uid_touch';
$handler->display->display_options['arguments']['uid_touch']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid_touch']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['uid_touch']['title'] = '%1 missed updates';
$handler->display->display_options['arguments']['uid_touch']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['uid_touch']['validate_type'] = 'user';
$handler->display->display_options['arguments']['uid_touch']['validate_options']['type'] = 'either';
$handler->display->display_options['arguments']['uid_touch']['validate_options']['restrict_roles'] = 0;
$handler->display->display_options['arguments']['uid_touch']['validate_fail'] = 'empty';
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'missed2';
----
Here are the error messages that result:
ERROR 1:
Notice: Undefined property: views_handler_argument_comment_user_uid::$operator in views_handler_argument_comment_user_uid->query() (line 47 of /var/www/new/sites/all/modules/views/modules/comment/views_handler_argument_comment_user_uid.inc).
ERROR 2:
User notice:
'Exception: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens'
in views_plugin_query_default->execute() (line 1197 of /var/www/new/sites/all/modules/views/plugins/views_plugin_query_default.inc).
Thank you very much in advance for your help.
I can also give you a view that produces the "PDOException" error (adding a pager will cause the error), but my central concern is to get the "Node: User posted or commented" functionality working.
Andrew
Comment #4
dawehnerThis fixes the notice/error but the sql is not working yet.
Comment #5
dawehnerAfter some work this should work now.
Comment #6
dawehnerHey i said fixed
Comment #7
neopoet CreditAttribution: neopoet commentedDereine,
Thanks for your efforts. I still get this error:
User notice:
'Exception: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens'
in views_plugin_query_default->execute() (line 1197 of /var/www/new/sites/all/modules/views/plugins/views_plugin_query_default.inc).
Also, the view itself does not function.
Andrew
Comment #8
neopoet CreditAttribution: neopoet commentedCan anyone else please help? The patch above doesn't solve this issue. Thank you very much.
Comment #9
aspilicious CreditAttribution: aspilicious commentedalakon did you downloaded latest views version?
Comment #10
neopoet CreditAttribution: neopoet commentedYes (both: at the time, yes, and as of now, yes -- I now have the latest Drupal 7 version and the latest of all installed modules). Still does not work.
Error message:
User notice:
'Exception: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens'
in views_plugin_query_default->execute() (line 1197 of /var/www/new/sites/all/modules/views/plugins/views_plugin_query_default.inc).
Comment #11
dawehnerCommited a fix
Comment #12
neopoet CreditAttribution: neopoet commentedI just tested this on a clean site with the latest install (Drupal RC1 and Views dev from 10 December 2010) and only the comment, views, and ctools modules enabled. I still have a problem with the view. Now all nodes are displayed, even those with no connection with the logged in user.
Comment #13
neopoet CreditAttribution: neopoet commentedChanging title to reflect that the lack of functionality, rather than the error, is most important here.
Comment #14
dawehnerd7 query:
d6 query:
In general it looks fine and it works fine here. Please run this sql manually and look at the result.
Are you sure that the result is really not what you want?
Do you might have "display all values" by default ticked on?
A export always helps :)
Comment #15
neopoet CreditAttribution: neopoet commentedI can confirm that the manual query above does show the correct values. [EDIT: The "limit 10" statement led me to believe this -- I reran this and this is not the case]
However, the SQL query behind my view is somewhat different (and continues to show all values, instead of just the correct ones):
SELECT node.nid AS nid FROM `node` node WHERE ((( (node.uid = '1') OR (0 < (SELECT COUNT(*) AS expression FROM (SELECT c.cid AS cid, 1 AS expression FROM `comment` c WHERE (c.uid = 1) AND (c.nid = nid) ) subquery)) )))
If you do a diff, you see that this query strikes ", users.uid AS users_uid" and " INNER JOIN `users` users ON node.uid = users.uid"
Any idea why?
Unfortunately no, "displays all values" isn't turned on. I created a new, super simple view that will help us test ... export to come in the next comment.
Comment #16
neopoet CreditAttribution: neopoet commented$view = new view;
$view->name = 'missedupdates5';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Node: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid']['element_label_colon'] = 1;
$handler->display->display_options['fields']['nid']['element_default_classes'] = 1;
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
$handler->display->display_options['fields']['nid']['link_to_node'] = 1;
/* Argument: Node: User posted or commented */
$handler->display->display_options['arguments']['uid_touch']['id'] = 'uid_touch';
$handler->display->display_options['arguments']['uid_touch']['table'] = 'node';
$handler->display->display_options['arguments']['uid_touch']['field'] = 'uid_touch';
$handler->display->display_options['arguments']['uid_touch']['default_action'] = 'empty';
$handler->display->display_options['arguments']['uid_touch']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['uid_touch']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid_touch']['validate_type'] = 'user';
$handler->display->display_options['arguments']['uid_touch']['validate_options']['restrict_roles'] = 0;
$handler->display->display_options['arguments']['uid_touch']['validate_fail'] = 'empty';
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'test5/%';
$translatables['missedupdates5'] = array(
t('Defaults'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort By'),
t('Asc'),
t('Desc'),
t('Nid'),
t('All'),
t('Page'),
);
Comment #17
dawehnerThe difference in sql is the join because i added a user:name field.
Comment #18
neopoet CreditAttribution: neopoet commentedI create an example query which generates the result I would expect (that is, returns a list of nodes where a particular user, in this case, UID =1, has A) authored a node and/or B) commented on a node). This might be helpful in your debugging. I would also ask that, if you are comparing the result with the SQL in comment #14, that you remove the LIMIT statement. In my test, the result of the comment #14 query had a result equal to the length of the node table.
Here goes:
(where UID is assumed to be 1)
Comment #19
dawehnerSadly forget union, it's not supported by views.
Do you see any difference between d6 and d7 query which leads to the error?
There has to be a reason in the current sql that it doesn't work.
Comment #20
neopoet CreditAttribution: neopoet commentedCan't we just use the D6 query? All we have to do is rename the "comments" table to the "comment" table:
Comment #21
dawehnerHehe :) If life would be such easy.
Does this patch perhaps works for you?
Comment #22
neopoet CreditAttribution: neopoet commentedUnfortunately not.
Comment #23
dawehnerThe best thing to really fix the issue would be to write a simpletest which proves that this isn't working right at the moment.
Once there is a simpletest it can be fixed.
Comment #24
neopoet CreditAttribution: neopoet commentedI looked at this -- it seems to be above my ability to do this. Is there anyone else you know who might be able to help?
Comment #25
neopoet CreditAttribution: neopoet commentedThe good news: I created a patch which fixes this problem.
The bad: I still can't figure out the "function query" API (and can't find any useful documentation) so I wasn't able to code it in standard Drupal Views format. This probably isn't suitable to be committed, but I hope it's a useful guide to whoever does know the format and can fix the problem in the correct way.
Comment #26
neopoet CreditAttribution: neopoet commentedApologies -- I had uploaded an early version of the previous patch. The one now attached is not hard coded to uid = 1. So it is functional, but it is likely not standard Drupal code.
Comment #27
dawehnerCan you please show the difference in the generated sql code?
At the moment i don't see a reason why this should work in contrast to the previous verison with the dbtng code
Comment #28
neopoet CreditAttribution: neopoet commentedThe original D7 code produced:
This code produces:
I wish I knew enough about SQL to articulate the differences, but you can see that this uses a somewhat less complex way of doing the comparison. You can also see that it is much closer to the original D6 query. Somebody who knows SQL well might be able to help explain it. In any case, you can see the difference in output yourself if you run both as a manual query on your database (and you'll see see the first query's output is equal in length to a list of all nodes in your database)
Comment #29
dawehnerAs long noone actually understands the the real code, i'm not sure whether we want to commit this.
I see technical no big difference at all in the sql, but when you say it works, i'm probably wrong.
Comment #30
dawehnerComment #31
neopoet CreditAttribution: neopoet commentedI don't understand.
Comment #32
dawehnerThere is another issue which was marked as duplicate of this issue.
The user reported this comment. Perhaps this helps to fix the issue.
Comment #33
bryancasler CreditAttribution: bryancasler commentedIf I am user1 and I have published node1 then this view will display to me node1
If user1 comments on node2, a post by user2, then this view should display node1 and node2
However instead of just displaying node1 and node2, it will display node1 and every node created by user2
http://awesomescreenshot.com/09e9yjyd6
I hope this clears things up, because the problem is hard for me to word clearly.
Here is my duplicate post #1104664: (Content: User posted or commented) is broken
Comment #34
kirillsmile CreditAttribution: kirillsmile commentedyep, same thing. i would like to use views as a replacement for the standart tracker, but just can't do this anymore, because "content: user posted or commented" didn't work at all.
i'd like to show user tracker, but now it showing me all the posts authored by users that i have commented.
the 6.х worked pretty well, but 7 is not, defenitely.
please, anything to fix this error?
Comment #35
dawehnerIt could be that #1112854: Subqueries use wrong arguments is the reason for this problem, too.
Comment #36
Adam S CreditAttribution: Adam S commentedI'm having problems with this too and patch on #26 fixed the problem.
Comment #37
BenStallings CreditAttribution: BenStallings commented#26 patch worked for me.
Comment #38
dawehnerFrom my perspective this bug should be fixed in core.
The patch in 26 doesn't really use dbtng syntax so it's not what should be done.
Comment #39
Adam S CreditAttribution: Adam S commentedDoes the patch referred to in #35 fix the problem?
Comment #40
dawehnerIt fixes the unterlying problem, but it's currently not 100% how the dbtng maintainers want it to be, so it needs a rewrite.
Comment #41
dawehnerLet's mark it as duplicate of the subquery bug.
Comment #42
bryancasler CreditAttribution: bryancasler commenteddereine can you link to the subquery bug que? I'd like to follow along there.
Comment #43
dawehnerSorry #1112854: Subqueries use wrong arguments
Comment #43.0
neopoet CreditAttribution: neopoet commentedUpdating for clarity
Comment #44
neopoet CreditAttribution: neopoet commentedI've been using my home grown solution #26) for a while on an old version of views. I upgraded to the latest -dev (with Drupal 7.9) hoping that #1112854 (which has been committed) would fix this issue. Unfortunately it hasn't.
While the error has been resolved, the result is that the view displays a list of all nodes (the original functional issue here)
Note - it might be worth checking out the related issue with filters: #1006482: Filter: User posted or commented does not work
This is the associated query:
SELECT node.nid AS nid, node.created AS node_created
FROM
{node} node
WHERE (( (node.status = '1') AND( (node.uid = '1') OR (0 < (SELECT COUNT(*) AS expression
FROM
(SELECT 1 AS expression
FROM
{comment} c
WHERE (c.uid = 1) AND (c.nid = nid) ) subquery)) )))
ORDER BY node_created DESC
LIMIT 10 OFFSET 0
This is an export of the view:
$view = new view;
$view->name = 'test22';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test2';
$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['title'] = 'test2';
$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['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* 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']['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']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 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']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* 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: Content: User posted or commented */
$handler->display->display_options['arguments']['uid_touch']['id'] = 'uid_touch';
$handler->display->display_options['arguments']['uid_touch']['table'] = 'node';
$handler->display->display_options['arguments']['uid_touch']['field'] = 'uid_touch';
$handler->display->display_options['arguments']['uid_touch']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid_touch']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['uid_touch']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['uid_touch']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid_touch']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid_touch']['summary_options']['items_per_page'] = '25';
/* 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'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test2';
Comment #45
dawehnerYou are right, this is a duplicate of #1006482: Filter: User posted or commented does not work
Comment #46
neopoet CreditAttribution: neopoet commentedI've tested this - unfortunately, even with 7.x-3.0-rc3, the issue is the same.
To reiterate:
Problem: When adding the contextual filter "Content: User posted or commented", the behavior is not as expected.
Expected behavior: A list of content that the user posted or commented on.
Actual result: A list of every piece of content on the site
SQL output (on 7.x-3.0-rc3):
Export of view:
Comment #47
merlinofchaos CreditAttribution: merlinofchaos commentedThis query looks correct to me. If somehow that query is pulling up a node that user #1 did not post or comment on, I don't know how. At best there may be some weirdness with how MySQL is interpreting this:
AND (c.nid = nid)
If that's true, that may actually be a bug in MySQL and if that is the case, I don't think there's anything we can do about it.
Comment #48
neopoet CreditAttribution: neopoet commentedFrustrating!
I've ran the query in phpmyadmin to make sure it's not a caching issue or something else. Unfortunately the query doesn't work.
I'm running 5.1.41-3ubuntu12.9-log (Ubuntu)
Does this work for anyone else?
If this really is a MySQL issue, can anyone help submit a bug report to the MySQL team? Or does anyone else have a different perspective or see why this is a problem?
Comment #49
merlinofchaos CreditAttribution: merlinofchaos commentedDoes it work if you use this query instead?
Comment #50
neopoet CreditAttribution: neopoet commented#1054 - Unknown column 'aliased_nid' in 'where clause'
Comment #51
merlinofchaos CreditAttribution: merlinofchaos commentedIiiiinteresting. Try this:
Comment #52
neopoet CreditAttribution: neopoet commentedYes!
Comment #53
merlinofchaos CreditAttribution: merlinofchaos commentedHm. Okay, that might be fixable in Views.
Comment #54
Ate_f CreditAttribution: Ate_f commentedHi There, I think I might be having the same issue. I'm trying to track all nodes/comment where a user has posted a comment. I'm fairly new to drupal and helping with issues. I'm running drupal 7.9 and the newest views version(rc3).
I attached the exported view. The error I received was: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node_nid' in 'where clause'.
Is there any way I can help? The posted patches didn't apply(I'm guessing views was updated in between)
Comment #55
dawehnerSo here is a patch which worked for me on the view from http://drupal.org/node/972934#comment-5316900
Please test this :)
Comment #56
Ate_f CreditAttribution: Ate_f commentedIt certainly seems to work! Thanks a great deal. If you need me to post any data please let me know, I'd be happy to help.
Comment #57
neopoet CreditAttribution: neopoet commentedFixed! Thank you!
Comment #58
dawehnerThis certainly can't be right!
Comment #59
dawehnerJust committed a slighly different patch. The tests are still running fine.
Comment #61
miguel_angel CreditAttribution: miguel_angel commentedStill active:
Notice: Undefined property: views_handler_argument_comment_user_uid::$name_table_alias en views_handler_argument->summary_name_field() (línea 869 de /mysite/sites/all/modules/views/handlers/views_handler_argument.inc).
Here's the exported view:
Comment #62
DamienMcKenna@miguel_angel: Have you tried with the latest -dev release?
Comment #62.0
DamienMcKennaRemoving original message (since it is now archived with the revisions tool)