New module 'Nodecomment'

This commit is contained in:
Manuel Cillero 2017-07-26 11:36:38 +02:00
parent 09b74574f1
commit 3c2bb788b4
26 changed files with 3513 additions and 0 deletions

View file

@ -0,0 +1,18 @@
<?php
/**
* Argument handler to accept a user id to check for nodes that
* user posted or commented on (using Nodecomment).
*
* Based on original handler from the Views module.
*/
class nodecomment_handler_argument_comment_user_uid extends views_handler_argument_comment_user_uid {
function query() {
$this->ensure_my_table();
// This copies comment handler query. It could be rewritten in various
// different ways, but all variants would suck in terms of performance.
$where = "$this->table_alias.uid = %d OR
((SELECT COUNT(*) FROM {comments} c WHERE c.uid = %d AND c.nid = $this->table_alias.nid) > 0) OR
((SELECT COUNT(*) FROM {node_comments} nc WHERE nc.uid = %d AND nc.nid = $this->table_alias.nid) > 0)";
$this->query->add_where(0, $where, $this->argument, $this->argument, $this->argument);
}
}