0

I'm attempting to use the image_title module to replace a node's title by an uploaded image. I thought it was working, but I've since discovered that it was only showing for me, not for anyone else on the site. =(

In debugging, I inserted the following into the image_title_preprocess_page() function:

$fh = fopen('/tmp/myfile', 'w');
fwrite($fh,date('r') . " starting page\n");

and I've found that this hook isn't getting called for anonymous users. I can't think of why that would happen. I also don't know much about the process by which hooks are run, though.

Perhaps page caching is causing the hook not to be called?

EDIT: If I just bypass the web server & call php index.php directly, image_title_preprocess_page() does get called, but then it does a SELECT image FROM {image_title_menu} and it finds nothing relevant. I have to wonder why it's using the 'page' hook instead of the 'node' hook in the first place though. Maybe this module just plain doesn't work.

I'm using Drupal 6.22, and while I'm investigating this (and maybe after, too) I've got a github fork here: https://github.com/kenahoo/drupal-image_title .

Thanks.

1
  • I'm wondering if caching (of something, not sure what) might be responsible for what I'm seeing though, and maybe there's some other mechanism that's causing the image not to be displayed. Commented Jan 19, 2012 at 3:38

2 Answers 2

1

A quick search of the issue queue yielded this.

Apparently the maintainer has been fixing it since Sep 2010. :-) I just fixed it, patch is there on that issue queue. Ask if you need to know how to apply the patch.

Also rather than manage a github fork, you should work on a local copy of the official repository and submit patches. That way it's much more convenient for the maintainer if you end up fixing it.

4
  • Thanks for finding that ticket. I actually created the fork because it looks like the project owner has essentially abandoned it, but still has good intentions: drupal.org/node/555654 . As this particular bug demonstrates though, the module has been completely broken for 2 years. Commented Jan 19, 2012 at 20:47
  • VERY depressing, especially for such a small, one-feature type module. It wouldn't be that hard to whip it into shape, but there's no one at the helm. Still though, ditch github and make a d.o sandbox fork if you must.
    – paul-m
    Commented Jan 20, 2012 at 6:38
  • Yes, much better idea. Commented Jan 20, 2012 at 16:53
  • I'm having some git problems, I cloned the original repo, cherry-picked & committed the changes I want, created a sandbox repo, but can't figure out how to push everything to my sandbox. I must be setting up the remote wrong. Commented Jan 20, 2012 at 20:37
1

Figured it out. There was this crazy code in image_title_nodeapi():

function image_title_nodeapi(&$node, $op, $teaser, $page) {
  if ( !user_access('create image titles') ||
       (variable_get('image_title_'. $node->type, 1) == 0) ) {    
     return; // do nothing ... 
   }

Which meant people could only see the images if they could also create images. Not real bloody useful! Fixed here: https://github.com/kenahoo/drupal-image_title/commit/a4458676e7a6d1e00839a3d0e02a9d6c4f01fe2c

Update: on Paul's advice I created a fork in the Drupal Sandbox area: http://drupal.org/sandbox/kenahoo/1411716 . I'm probably going to delete the github.com project now.

1
  • Haha, nice. We fixed it at the same time. :-)
    – paul-m
    Commented Jan 19, 2012 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.