The help description for the filter "Node: Current User Authored or Commented" states:
"This allows you to filter by whether or **not** the logged in user authored or commented on the node." (emphasis added)

However, the filter only allows for positive use. One cannot use this filter (despite what the help text says) to show users nodes that they have *not* commented on.

I will attach a patch in a moment that fixes this error.

Comments

neopoet’s picture

Assigned: neopoet » Unassigned
Status: Active » Needs review
StatusFileSize
new1.35 KB
dawehner’s picture

Status: Needs review » Needs work

This doesn't seem to be the right drupal code style:

+} else {
+  $query->add_where("node.uid != '%s' OR $table.uid != '%s'", $filter['value'], $filter['value']);
+}

Additional, are you sure that this is the logical opposite? I don't know whether you know the De Morgans Laws but they would do:

+  $query->add_where("node.uid != '%s' AND $table.uid != '%s'", $filter['value'], $filter['value']);
neopoet’s picture

Dereine,

Thanks for reviewing my report.

I agree. De Morgan's Law would apply. You can change the "OR" to "AND".

I apologize for the coding style -- I am a novice programmer. I thought it would be best to submit a potential patch if I was able rather than just complain about something that's missing.

Regards,

Andrew

neopoet’s picture

Status: Needs work » Needs review
StatusFileSize
new1.26 KB

I've made the correction. I also ran this through the Drupal coder module -- it suggested that I split the "} else {" statement into a second line. Please let me know if the patch needs any other work.

dawehner’s picture

It should be

+ if ($filter['operator'] == '=') {
+ $query->add_where("node.uid = '%s' OR $table.uid = '%s'", $filter['value'], $filter['value']);
+ }
+ else {
+ $query->add_where("node.uid != '%s' AND $table.uid != '%s'", $filter['value'], $filter['value']);
+ }

:)

esmerel’s picture

Status: Needs review » Closed (won't fix)

At this time, only security fixes will be made to the 5.x version of Views.