I use the 'Insert View' module (http://drupal.org/project/insert_view, version insert_view-6.x-2.x-dev) on several of my pages to include a view. During each cron, link checker checks links on my site, and I get messages like this in the dblog:

access denied 18-1-2011, 10:43 admin/build/views/clone/sponsor_page_view Anonieme gebruiker  
access denied 18-1-2011, 10:43 admin/build/views/export/sponsor_page_view Anonieme gebruiker  
access denied 18-1-2011, 10:43 admin/build/views/edit/sponsor_page_view Anonieme gebruiker 

('Anonieme gebruiker' is Dutch for 'Anonymous user')

In the Apache logs, I see:

mywebsite.xx y.y.y.y - - [18/Jan/2011:10:43:04 +0100] "HEAD /admin/build/views/edit/sponsor_page_view?destination=batch%3Fid%3D67%26op%3Ddo HTTP/1.0" 403 - "-" "User-Agent: Drupal (+http://drupal.org/)" IN=169 UIT=469
mywebsite.xx y.y.y.y - - [18/Jan/2011:10:43:05 +0100] "HEAD /admin/build/views/export/sponsor_page_view HTTP/1.0" 403 - "-" "User-Agent: Drupal (+http://drupal.org/)" IN=133 UIT=469
mywebsite.xx y.y.y.y - - [18/Jan/2011:10:43:05 +0100] "HEAD /admin/build/views/clone/sponsor_page_view HTTP/1.0" 403 - "-" "User-Agent: Drupal (+http://drupal.org/)" IN=132 UIT=469

Which leads me to believe that it is caused by Link Checker, as I configured it to use the "User-Agent: Drupal (+http://drupal.org/)" user agent.

Is 'Link checker' incompatible with 'Insert View', or is something else going on here?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

Status: Active » Fixed

I'm not aware of such issues.

It sound more like you have published the admin urls admin/build/views/clone/sponsor_page_view to the public. Linkchecker sees them, tries to check them, but got the expected 403 (access denied). You should not publish admin urls to the public... Check the nodes source code and remove the admin links.

hass’s picture

Asside, this is only a view... The real links are somewhere else. I suggest you to disable the insert_view filter in the linkchecker settings. Referencing filters shouldn't evaluated as they produce false alarms in nodes that only hold a reference to other content. This is not good as users may not able to fix a broken link that is inside other nodes.

dhendriks’s picture

The node only contains a single line of text followed by the following:

[view:sponsor_page_view]

This line is converted by Insert View to the actual 'sponsor_page_view' view. Since I have the 'Do not show hover links over views' checkbox unchecked, in the Views' Tools tab, it means that the Edit/Export/Clone 'hover' links are added. They should only show up if the view is accessed as admin. Does Link checker access pages as admin? If so, I'm not sure I can do anything about removing them from the page. Would it be a good idea to have Link checker skip all admin/* links? Maybe that could be an option?

dhendriks’s picture

As for #2, I agree that in most cases the actual links are somewhere else. However, the view may have a header or footer text that contains links. By including the view in the page for Link checker (and not filtering it out), those links could then be checked as well. Also, since I am the only user that can access the link checker results, there is no problem with different users and inabilities to be able to fix broken links.

hass’s picture

Title: How to dynamically disable/remove views-admin-links if input filters are executed? » Link checker incompatible with 'Insert View' module?
Project: Views (for Drupal 7) » Link checker
Version: 6.x-2.x-dev » 6.x-2.4
Category: support » bug

No, linkchecker runs not as admin. This is why it complains about the link access. But i'm really asking me why this links are posted back. Need to take a deeper look if this may be a bug of linkchecker or insert view. Linkchecker always see everything you see. And if linkchecker see the hoover, your users should see them, too. Have you enabled them for anonymous users?

dhendriks’s picture

Category: support » bug
Status: Fixed » Active

No, anonymous users don't see the hover links.

hass’s picture

Title: Link checker incompatible with 'Insert View' module? » How to dynamically disable/remove views-admin-links if input filters are executed?
Project: Link checker » Views (for Drupal 7)
Version: 6.x-2.4 » 6.x-2.x-dev
Category: bug » support

So, I may was confused... linkchecker runs as the user that is currently logged in. If you save a form You are the one with the permissions and You are the one who save the links to the linkchecker_links table. As the admin links are part of the content that You see - linkchecker will see what You see. If I hover over the node in View mode I also see the hover links. This is the reason why linkchecker save this views admin links.

I currently have no clue how I'm able to stop this views behavior or how I'm able to remove them as I need to load the filters. As said I strongly suggest you to disable referencing filters in linkchecker settings. I do not really like to alter the GLOBAL variable views_no_hover_links. This looks all like hacking views to me and may cause side effects and is not an API way.

  if (user_access('administer views') && module_exists('views_ui') && empty($view->hide_admin_links) && !variable_get('views_no_hover_links', FALSE)) {

and I'm not sure how to make the hook killing the $vars['admin_links_raw'] array if the filters are executed by linkchecker and otherwise not.

drupal_alter('views_admin_links', $vars['admin_links_raw'], $view);

Maybe someone from the views team can share an idea how we can run the insert_view filter with admin links disabled. If there is a way I may be able to add some code.

hass’s picture

Title: Link checker incompatible with 'Insert View' module? » How to dynamically disable/remove views-admin-links if input filters are executed?
Project: Link checker » Views (for Drupal 7)
Version: 6.x-2.4 » 6.x-2.x-dev
Category: bug » support
Status: Active » Needs review
FileSize
1.97 KB

Linkchecker patch attached to workaround this views issue. Need Views maintainer confirmation if there is no better way with an API.

dhendriks’s picture

Just to let everyone know: this is no longer an issue for me, as I got rid of using the 'Insert View' module, and I disabled the hover links, as I find them annoying anyway...

It is however still 'broken', so other people might still appreciate a patch.

merlinofchaos’s picture

Project: Views (for Drupal 7) » Link checker

hass: I only think of one thing better. It's kind of an unusual situation brought on by the insert_view module.

Honestly, I think insert_view should be setting the flag to disable the hoverlinks. I don't think they really should be used when inserting a view into a node. But that's up to the insert_view maintainers, and this patch works around that. insert_view maintainers may see it differently.

Sending this back to linkchecker, I guess, as I can't think of anything that we can do on the views side to address this. Sorry I can't provide more useful insight.

hass’s picture

Title: How to dynamically disable/remove views-admin-links if input filters are executed? » Disable unusual hover links for compatibility with other modules like linkchecker
Project: Link checker » Insert View
Category: support » bug
Status: Needs review » Active

Yeah, thank you for your comment. insert_view seems to be unmaintained from project home comments...

Let's see what the insert_view maintainers like to do with your feedback.

hass’s picture

hass’s picture

Status: Active » Needs review
FileSize
786 bytes

Patch attached. Applies to D6 and D7.