* warning: Missing argument 3 for xmlsitemap_node_views_query_alter(), called in /var/www/vhosts/friederschueler/html/sites/www.friederschueler.de/modules/views/includes/view.inc on line 549 and defined in /var/www/vhosts/friederschueler/html/sites/www.friederschueler.de/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module on line 418.
 * warning: Missing argument 4 for xmlsitemap_node_views_query_alter(), called in /var/www/vhosts/friederschueler/html/sites/www.friederschueler.de/modules/views/includes/view.inc on line 549 and defined in /var/www/vhosts/friederschueler/html/sites/www.friederschueler.de/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module on line 418.

Fresh and clean install of Drupal 6.2, with Views 6.x-2.0-beta3 and Xmlsitemap 6.x-0.x-dev.
I view a post and then try to fetch the backlinks to this page. ("Pages that links to ...").

Example URL: http://www.friederschueler.de/node/61/backlinks

CommentFileSizeAuthor
#6 xmlsitemap_fix_views.txt753 byteswayland76

Comments

Frieder’s picture

merlinofchaos from Views says:

Well, the nature of that error looks like XMLSiteMap is incorrectly implementing hook_views_query_alter -- probably using leftovers from the Views 1 stuff. I feel confident this is an XMLSiteMap issue.

Can you fix that?

ehsan.akhgari’s picture

Trying to get this in my tracker...

jwilde’s picture

I'm getting the same thing. I tried to fix it but in the end I commented out the code for function xmlsitemap_node_views_query_alter.

jim

wayland76’s picture

merlinofchaos is quite right.

The old code reads:

function xmlsitemap_node_views_query_alter(&$query, &$view, $summary, $level) {

The documentation for the new views says we should use:

function hook_views_query_alter(&$view, &$query) {

I don't know what's happened to summary and level, but seeing as how we're not using them in our function anyway, they probably don't matter that much. The main questions are things like:
1. Does the $query object still have the same API that it had in Views 1?
2. Do the other views hooks still function?

The views 2 documentation is currently sketchy, and I don't have enough Views expertise to answer these questions.

Frieder’s picture

Status: Active » Needs work

I changed the code from:

function xmlsitemap_node_views_query_alter(&$query, &$view, $summary, $level) {

to

function xmlsitemap_node_views_query_alter(&$view, &$query) {

The problem is i am very new to drupal, and I dont understand, why xmlsitemap uses there this hook, and what for? I dont believe that things work now as expected, but at least the errors are gone :)

wayland76’s picture

Status: Needs work » Needs review
StatusFileSize
new753 bytes

Ok, here's a proper patch (identical to Freider's solution). I have to admit, I'm not 100% sure what's going on here either. I'm guessing that between the two views hooks (Frieder: are you familiar with hooks?) to make it so that Views 2 can work with some of the XML Sitemap data. If you go into views, and see either "XML Sitemap: Sitemap" or "XML Sitemap: News", and those features seem to be working proerly, then everything's probably fine. Unfortunately, XML Sitemap seems to be crashing my 6.x site at the moment, so I can't test it :).

Frieder’s picture

Component: xmlsitemap » xmlsitemap_node

I know hooks from wordpress, I also know some php stuff, but I am completly new to Drupal :)
I made clean fresh install of Drupal with CCK , Views 2 and some other stuff but Xmlsitemap works really fine for me.
Maybe DarrenOh can review this patch :)

wayland76’s picture

Well, when the Views module gets to certain points in its code, it calls any function that's called *_views_query_alter. So you can see how the above one works.

We've got one review anyway; if we can get one or two more people to test it, that should cover things a bit.

darren oh’s picture

Status: Needs review » Fixed

Fixed in CVS commit 118144.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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