Hi,

in short: I don't understand what happened with $links in D6 at all. As well in upgraded sites (D4/D5->D6) as in fresh D6 installations I can't print stuff in the area that used to be the "Links" section that belonged to a node. The only thing I'm seeing in the (former) links section of a node are duplicates of the node's tags (which are already printed with $terms in node.tpl.php), but I can't enable a link to the commenting form, I can't display node access statistics etc. That applies as well to unaltered core themes like 'Garland' as to customized 'Zen' or 'Fusion' sub themes, or other (unaltered) contributed themes like 'Minelli'.

In D5 I was used to be able to use an area like

    <?php if ($links): ?>
    <div class="links">
      <?php print $links; ?>
    </div>
    <?php endif; ?>

to display lots of useful stuff, based on access permissions and context, e.g. node access statistics, the "report as spam" link from mollom, edit/delete quick links for editors, contact link to send a mail to the node's author (via contributed 'contactlink' module), and in the links section used to be the "Read more" and "Post comment" links. Nothing of this works anymore in D6, at least not the way it used to be.

In the access permissions (./admin/user/permissions), e.g. "display access counter" is checked for the proper user roles, and I'm getting those links not even as user #1 in the $links area. Is there something I have to enable before those links from Core Statistics, from Mollom, from 'Contactlink' etc. will show up? Maybe I have to manually add some preprocessing function to my theme's template.php? Or is this even intended behaviour that changed from D5 to D6?

Again, this seems to be independent from the theme I'm using and occurs also on a fresh D6 setup without any contributed modules and with the 'Garland' theme. Also I'm having this bahaviour currently on three D6 and seven migrated D5 sites, so this can't be caused by a glitch in the upgrade scripts. I'm currently running Drupal 6.15 on these sites, all contributed modules are up to date (according to /admin/reports/status), and update.php has been run properly after every module update. In the watchdog log (./admin/reports/dblog) I'm not seeing any related errors.

So this question simply is: How do I display node access statistics from Drupal Core statistics.module, the "Post comment" or the "Read more" links, the "Report as spam" link from Mollom, or the "Contact the author" link from the contributed Commentlink module in the "Links" section?

Thanky you for any suggestion & greetings, -asb

Comments

WorldFallz’s picture

I'm not sure where your problem is, but $links most certainly exists in d6: http://api.drupal.org/api/drupal/modules--node--node.tpl.php/6. All the modules i use that add stuff to those links work perfectly.

jaypan’s picture

Maybe hook_links() is more what you are looking for.

Contact me to contract me for D7 -> D10/11 migrations.

asb’s picture

hook_links() allows contributed modules - like Mollom, Contactlink, etc. - to add links to $links, as I understand it.

I'm not developing a module, I'm simply using modules - like Mollom, Contactlink, or Drupal core's statistics - that are supposed to already have added their links to the $links array. My problem is, that none of these links show up where $links is printed.

I find it extremely bizarre that I seem to be having this issue. If nobody else experiences this, what could cause a behaviour like this?

Thanks & greetings, -asb

WorldFallz’s picture

First thing I would do is disable any contributed modules you might be using and see if the problem goes away. if it does, it's related to one of the contribs.

EDIT: my bad, I see where you've done this already. I'm at a loss then-- I've never seen this before. If you have the devel module, try putting <?php dsm($links);?> somewhere in your node.tpl.php file.

asb’s picture

Hi,

if I enable the 'devel' module and put <?php dsm($links);?> in in a <?php if ($links): ?> clause in my node.tpl.php, I'm getting a green message box with something like:

<span id="thmr_15" class="thmr_call">
  <ul class="links inline"><li class="taxonomy_term_84 first"><a href="/spielfilm" rel="tag" title="">Spielfilm</a></li>
<li class="taxonomy_term_86 last"><a href="/video_dvd" rel="tag" title="">DVD</a></li>
</ul></span>

If I put <?php dsm($links);?> at the end of my template, I'm getting the same output.

Also I played a bit with node.tpl.php; if I'm putting something like this into the node template...

<?php if ($links): ?>
    <?php print $links; ?>
    <?php if ($teaser && user_access('administer nodes')): ?>
      <?php $content_type_name = node_get_types('name', $node); ?>
      <?php $quick_links['quick-edit'] = array('title' => 'Edit', 'href' => 'node/' . $nid . '/edit'); ?>
      <?php $quick_links['quick-outline'] = array('title' => 'Outline', 'href' => 'node/' . $nid . '/outline'); ?>
      <?php $quick_links['quick-outline'] = array('title' => 'Revisions', 'href' => 'node/' . $nid . '/revisions'); ?>
      <?php $quick_links['quick-outline'] = array('title' => 'Clone', 'href' => 'node/' . $nid . '/clone'); ?>
      <?php $quick_links['quick-delete'] = array('title' => 'Delete', 'href' => 'node/' . $nid . '/delete'); ?>
      <?php print theme('links', $quick_links, array('class' => 'links inline')); ?>
    <?php endif; ?>
<?php endif; ?>

...I'm getting indeed something like Edit Clone Delete in that what used to be the links section.

In the meantime I've collected a couple of possibly related issues in the contrib modues issue queues:

If D6 really still has the "Read more", "Comment", "Mollom", etc. links (I'm starting to believe it ;), I'm suspecting that some theme or module has left an entry somewhere in the database (something like 'Themesettings' or 'Temesettings API' maybe) which modifies $links permanently and by overriding the template's settings. But that's nothing but a wild guess...

Greetings, -asb