A user just reported to me that the "printer-friendly" link on photo pages wasn't working. When I looked, I discovered that drupal was adding a book type link (for example, "http://www.chesmontastro.org/?q=book/print/220") to every photo page.

Can someone tell me why this link is appearing and how I supress it?

I'm running drupal 4.6.4 and the december 2nd version of acidfree.

Comments

mwheinz’s picture

Title: "printer-friendly" links appearing in acid-free photo pages. » Update - acidfree pages also showing "add child page" at the bottom of photos.

So is something making drupal confuse books and acidfree albums?

mwheinz’s picture

Okay, I'm not at all familiar with the drupal code, but poking around it looks like the bug is in book.module, not acidfree.module. Here's a possible patch, but I'm not sure I like what it implies - does drupal really call every single module for every page view?

*** /mirror/var.0/www/www.chesmontastro.org.drupal/modules/book.module Fri Jul 29 03:29:25 2005
--- book.module Mon Dec 5 08:59:17 2005
***************
*** 55,61 ****

$links = array();

! if ($type == 'node' && isset($node->parent)) {
if (!$main) {
if (book_access('create', $node)) {
$links[] = l(t('add child page'), "node/add/book/parent/$node->nid");
--- 55,61 ----

$links = array();

! if ($type == 'node' && isset($node->parent) && $node->type == 'book') {
if (!$main) {
if (book_access('create', $node)) {
$links[] = l(t('add child page'), "node/add/book/parent/$node->nid");

vhmauery’s picture

Status: Active » Closed (duplicate)

You are right in saying this is a book.module problem. And yes, every module does get invoked for lots of stuff. That is what the nodeapi stuff is all about. For each action (load, insert, modify, delete, form, view, etc.) EVERY module gets called and the affected node gets passed. It makes for a very simple interaction between modules.

The book module assumes that EVERY node with a parent field must be a book and adds the links when viewing. I already have a bug open on this and seem to have been ignored for a long time. Either way, I am marking this as a duplicate of that bug -- http://drupal.org/node/34363