XML Sitemap implements hook_views_query_alter(), but it has a problem.
The code it uses contains the following lines:

  switch ($view->page_type) {
    case 'xmlsitemap_news':
      $query->add_field('created', 'node');
      // ...
  }

which causes a PHP message error because the property page_type doesn't exist.
What would be the correct property to use in such cases?

Thanks in Advance for any help.

Comments

avpaderno’s picture

A little more informations; the implementation of the hook is defined:

function xmlsitemap_node_views_query_alter(&$query, &$view, $summary = NULL, $level = NULL)
merlinofchaos’s picture

Status: Active » Fixed

That is Views 1 code, clearly. You might try checking $view->style_plugin but I fear that there is a larger problem here: The general flow of a view is very different now, and using query alter is unnecessary as style plugins in Views 2 have a query() method that they can use to directly modify the query themselves. The style plugin being used there needs to be rewritten.

You can probably just comment out this code for now.

avpaderno’s picture

Thanks for your help.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.