[support] help with: bypassing Views Taxonomy filter limitation
sebastian
inforazor at gmail.com
Tue Oct 25 11:12:29 UTC 2011
Hello,
Have a noodle here.
D6, V2. If I make a View and set the filter to:
Does NOT contain TERM "personal"
And then I run the display, it will NOT show a Node that has ONLY one
tag that says "Personal". But if I have more tan one Tag on that node,
then it WILL show the Node, making my filter useless...
So I wrote a HOOK to pre-process the query:
function joinTaxonomy_views_query_alter(&$view, &$query) {
if($view->name == 'blog_feed'){
dpm($view);
}
}
Now I can see that there are values I can change, but I am unfortunetly
not a mySQL query-master.
The $query that it generates*, which needs adjusting, is:
SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS nid,
node.title AS node_title,
node.created AS node_created,
node.type AS node_type,
node.vid AS node_vid,
node_revisions.teaser AS node_revisions_teaser,
node_revisions.format AS node_revisions_format,
node.uid AS node_uid
FROM {node} node
LEFT JOIN {term_node} term_node ON node.vid = term_node.vid
LEFT JOIN {term_data} term_data ON term_node.tid = term_data.tid
LEFT JOIN {node_revisions} node_revisions ON node.vid = node_revisions.vid
WHERE (node.status <> 0) AND (node.type in ('%s')) AND
(UPPER(term_data.name) NOT LIKE UPPER('%%%s%%'))
GROUP BY nid
ORDER BY node_created DESC
) count_alias
Can anyone tell me what the query SHOULD be so that it excludes any node
which has my defined Term-name and not just nodes that ONLY have my
designated rejected-term filter?
If it is helpful I can give a full-dump of the $views variable here, but
trying not to kill you with detail.
If a TID is easier, I know the TID and it won't change very often, if
ever, so I could hard code it to a number, if that's helpful...
Thank you so much for your help!
Sincerely,
S.
* $query taken from:
views.inc
/**
* Execute the view's query.
*/
function execute($display_id = NULL) {
// ...
$query
// ...
}
More information about the support
mailing list