Adding a "User Comments" heading before comments list in Drupal 6

Submitted by fabio on Fri, 2010-03-12 15:45.

For a website I'm working on I had the need to display an Heading saying something like "User Comments" just before the user comments list and after the node comments. This can help the website user clearly understand where the node content ends and where the visitors contributions starts.

Something like the following image (In italian):

An example of the final output

How to do it

I though it would have been a complex task: I thought it would have required to override some theming function and hacking deeply into Drupal.

Fortunately it wasn't complex at all. In Drupal 6 there are template files already available to be overriden for a lot of Drupal output.

In this case there is a file called comment-wrapper.tpl.php which we can override in our theme. This file is a wrapper for all the content generated by the comment module (comment lists, comment adding form, etc.).

So we can just place in a file called comment-wrapper.tpl.php within our theme directory the following code:

<?php
// from $Id: comment-wrapper.tpl.php,v 1.2 2007/08/07 08:39:35 goba Exp $
// modified by Fabio Varesano for ermannofalco.com

/**
 * @file comment-wrapper.tpl.php
 * Default theme implementation to wrap comments.
 *
 * Available variables:
 * - $content: All comments for a given page. Also contains sorting controls
 *   and comment forms if the site is configured for it.
 *
 * The following variables are provided for contextual information.
 * - $node: Node object the comments are attached to.
 * The constants below the variables show the possible values and should be
 * used for comparison.
 * - $display_mode
 *   - COMMENT_MODE_FLAT_COLLAPSED
 *   - COMMENT_MODE_FLAT_EXPANDED
 *   - COMMENT_MODE_THREADED_COLLAPSED
 *   - COMMENT_MODE_THREADED_EXPANDED
 * - $display_order
 *   - COMMENT_ORDER_NEWEST_FIRST
 *   - COMMENT_ORDER_OLDEST_FIRST
 * - $comment_controls_state
 *   - COMMENT_CONTROLS_ABOVE
 *   - COMMENT_CONTROLS_BELOW
 *   - COMMENT_CONTROLS_ABOVE_BELOW
 *   - COMMENT_CONTROLS_HIDDEN
 *
 * @see template_preprocess_comment_wrapper()
 * @see theme_comment_wrapper()
 */
?>
<div id="comments">
  <?php if($node->comment_count){ print '<h3 class="comments-intro">' . t("User Comments") . "</h3>"; } ?>
  <?php print $content; ?>
</div>

With the same approach we could add a link to the comment creation form (just adding a link to #comment-form) or adding a disclaimer. Actually with this approach there are lot of possible usage of modifying comment output.

What do you think about my approach? Did you find it useful? Do you have problems implementing it? Feel free to leave me a comment and let me know!

Are you using Mollom on Drupal? Then do not upgrade to 6.x-1.11

Submitted by fabio on Thu, 2010-02-18 00:19.

Some days ago I updated the mollom Drupal module version 1.10 installed on this site with the new version 1.11.

For those unfamiliar with Drupal, Mollom is a service which analize comments, posts, etc to check for spam and blocks suspicious content. Mollom has been founded by Dries Buytaert and Benjamin Schrauwen. Dries is the project lead of Drupal and CTO at Acquia. So, yes: Mollom is high quality stuff created and maintained by top people on the Drupal ecosystem.

Unfortunately, as soon as I updated the mollom module I noticed that something was wrong: the configurations of the protected forms where missing after the update. All my forms where unprotected.

As soon as I noticed this I opened a bug report, but today I had the time to have a deep look on this and I found that it's due to a bad bug in the update path from 1.10 to 1.11. I reported it to Dries and Dave and they agreed on the gravity of this bug.

This is pretty bad as it looses the protected forms configuration of 1.10: this results in leaving all the forms unprotected against spam. As Mollom is installed in high profile Drupal websites (Sony, Adobe, LinuxJournal, Warner Bros Records, Netlog, NBC, etc) the consequences of this bug can be pretty bad.

So, if you are a Drupal and Mollom user stay away from 1.11 and wait till 1.12 which will fix this issue. Patches are already available and a new release should came soon.

I ♥ Free (as in speach, not in bear) Software - Valentine's Day 2010

Submitted by fabio on Fri, 2010-02-12 19:38.

I love Free Software!

The Free Software Foundation Europe started a new campaign called I ♥ Free Software - Valentine's Day 2010.

I think this is a pretty cool way to promote free software so, as I do ♥ Free Software and I do hate proprietary software, I'm giving the campaign visibility here on my blog.

Unfortunately the campaign landing page fails to explain what is free software, so if you are interested you might want to read the What is free software page at fsf.org.

If you already support Free Software you might want to get some of the banners available on the campaign page and put them on your blog or personal website.

GNU/Linux bash: execute a command every X seconds indefinitely (without cron)

Submitted by fabio on Sat, 2010-01-16 11:38.

If you use the GNU/Linux operating system intensely as development environment or as a server you'll probably find yourself in need of running a determinate command or script every X seconds forever.

This could be useful for example to check that a service you run on your server is working correctly (e.g. your Apache httpd server), to clear some cache your system is using or to periodically check for software updates. Personally I needed this to periodically update the DNS entry of my home server with its current IP (my ISP gives dynamic IP, not static ones).

Cleaning the CPU Processor fan and dissipater of the Acer Aspire 5680 series (5685WLMi)

Submitted by fabio on Sun, 2010-01-03 15:07.

A simple step by step visual guide in disassembling an Acer Aspire 5680 (5685WLMi) in order to clean a dusted fan and dissipater. This will fix overheating and consequential shut downs.

"Firefox 2 theme for Firefox 3.x" version 0.9.7 out

Last updated on Tue, 2009-12-22 15:41. Originally submitted by fabio on 2009-12-19 11:36.

After some work and with the upcoming release of Firefox 3.6, it's time for a new version of the Firefox 2 theme for Firefox 3.x.

New version 0.9.7 adds the following features:

  • Adds icon on mouseover to item of forward-back overlay menu. Thanks user 0 for reporting this issue
  • CSS rules and 2 icons for Clear Recent History (Tools). Thanks user 0 for reporting this issue
  • Compatibility with upcoming Firefox 3.6
  • Enlarged the size of the Bookmark Overlay Interface
  • Added styles to default ogg video player bundled into firefox
  • Merging styling site identity button patch by George Pop

Hope you guys will like this!

"Firefox 2 theme for Firefox 3.x" version 0.9.6 beta 1 out

Last updated on Fri, 2009-09-18 17:48. Originally submitted by fabio on 2009-09-16 00:56.

I'm happy to announce the availability of version 0.9.6 beta 1 of my Firefox 2 theme for Firefox 3.x.

This is a beta version aimed to receive feedback from users. You are very welcome in testing the theme and report any issue, question or advice. You can post here as comment your opinions.

Version 0.9.6 beta 1 contains the following improvements:

"Firefox 2 theme for Firefox 3.x" version 0.9.5 out

Submitted by fabio on Wed, 2009-08-12 16:24.

I just pushed to addons.mozilla.org version 0.9.5 of the Firefox 2 theme for Firefox 3.x.

You can find the new version attached here or at addons.mozilla.org.

As always, please send me any bugs or improvements you might find commenting below. Thanks.

Problems with Samsung u700? Let's fix its flex flat cable!

Submitted by fabio on Sat, 2009-08-08 12:12.

Samsung U700Samsung U700

The Samsung U700 is a great phone with great calls quality and great features.

Unfortunately it's internal design produce with long term usage a malfunction which makes the phone unusable and broken.

In this article I analyze the problem and outline a procedure to replace a broken part and fix the problem.

"Firefox 2 theme for Firefox 3.x" version 0.9.4 out

Submitted by fabio on Tue, 2009-07-14 18:27.

After some days of tests by me and some friend who helped out I just submitted version 0.9.4 of the Firefox 2 theme for Firefox 3.x.

The version is waiting review by the editors at addons.mozilla.org so it's still not public. It should became available in some days. Once it became public it will be pushed to current users through firefox Addons automatic update.