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.
the hook_views_pre_execute(&$view) used for create/change the view's sql not work with view vers 6.x-3.x while work with 6.x-2.x
the function is called but the code for change the sql not work (isn't called)
function nameofyourmodule_views_pre_execute(&$view) {
drupal_set_message($view->name);
//if($view->name=="groups_list2") {
$view->build_info['query']="SELECT node.nid AS nid FROM node";
//$view->build_info['query']="SELECT node.nid AS nid FROM node LIMIT 2";
//}
}
I noticed that in views\includes\view.inc
in 6.x-2 there is this code (row 695):
// Let modules modify the view just prior to executing it.
foreach (module_implements('views_pre_execute') as $module) {
$function = $module . '_views_pre_execute';
$function($this);
}
$query = db_rewrite_sql($this->build_info['query'], $this->base_table, $this->base_field, array('view' => &$this));
$count_query = db_rewrite_sql($this->build_info['count_query'], $this->base_table, $this->base_field, array('view' => &$this));
$args = $this->build_info['query_args'];
vpr($query);
while in 6.x-3.x ther is only this (row 825):
// Let modules modify the view just prior to executing it.
foreach (module_implements('views_pre_execute') as $module) {
$function = $module . '_views_pre_execute';
$function($this);
}
in 6.x-2 there is more code; I also add this code in 6.x-3 but problem remain
Comments
Comment #2
alb CreditAttribution: alb commentedComment #3
alb CreditAttribution: alb commentedComment #4
alb CreditAttribution: alb commentedComment #5
alb CreditAttribution: alb commentedComment #6
alb CreditAttribution: alb commentedComment #7
alb CreditAttribution: alb commentedI also noticed that in the file views\includes\admin.inc in 6.x-3 there is this code (row 426):
_
I changed with those of 6.x-2:
but problem remain
I changed because noticed that after this row:
// Get information from the preview for display.
views 6.x-2 and views 7.x-3 use the same code
if (!empty($view->build_info['query'])) {
while 6.x-3 no
Comment #8
zalak.addweb CreditAttribution: zalak.addweb commentedComment #9
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue