Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function eb_mine_views_query_alter(&$view, &$query) {
- if ($view->name == 'statuser') {
- dsm($query, 'before');
- $query->where[0]['type'] = 'OR';
- dsm($query, 'after');
- }
- }
- ?>
- SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created
- FROM
- {node} node
- INNER JOIN {taxonomy_index} taxonomy_index_value_0 ON node.nid = taxonomy_index_value_0.nid AND taxonomy_index_value_0.tid = :views_join_condition_0
- INNER JOIN {taxonomy_index} taxonomy_index_value_1 ON node.nid = taxonomy_index_value_1.nid AND taxonomy_index_value_1.tid = :views_join_condition_1
- WHERE ((( (taxonomy_index_value_0.tid = :db_condition_placeholder_2) )**AND**( (taxonomy_index_value_1.tid = :db_condition_placeholder_3) )))
- ORDER BY node_created DESC
- SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created
- FROM node node
- OUTER JOIN taxonomy_index taxonomy_index_value_0 ON node.nid = taxonomy_index_value_0.nid AND taxonomy_index_value_0.tid = '9'
- OUTER JOIN taxonomy_index taxonomy_index_value_1 ON node.nid = taxonomy_index_value_1.nid AND taxonomy_index_value_1.tid = '6'
- WHERE ((( (taxonomy_index_value_0.tid = '9') )OR( (taxonomy_index_value_1.tid = '6') )))
- ORDER BY node_created DESC LIMIT 5 OFFSET 0;
- SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created
- FROM node node
- LEFT OUTER JOIN taxonomy_index taxonomy_index_value_0 ON node.nid = taxonomy_index_value_0.nid AND taxonomy_index_value_0.tid = '9'
- LEFT OUTER JOIN taxonomy_index taxonomy_index_value_1 ON node.nid = taxonomy_index_value_1.nid AND taxonomy_index_value_1.tid = '6'
- WHERE ((( (taxonomy_index_value_0.tid = '9') )OR( (taxonomy_index_value_1.tid = '6') )))
- ORDER BY node_created DESC LIMIT 5 OFFSET 0;
- function custom_views_query_alter(&$view, &$query) {
- if($view->name == "tag_cloud"){
- print_r($query);// before modifying the query.
- $query->table_queue['taxonomy_index']['join']->type = "LEFT OUTER JOIN";
- //sample field change where ever you want
- print_r($query);// after modifying the query .
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement