Template Tutorials

Remove 'Preview' button in Drupal 6 comment form

By default in Drupal 6, there is a 'Preview' button in addition to a 'Save' button in the form which allows a user to post a comment. For those of us who think it is silly to have a preview before posting, the good news is that you can remove the button quite simply with a bit of code.

Place the following code in the template.php file which exists in the directory for the theme that you are using. If your theme does not use a template.php file, go ahead and create one.

This code goes in template.php:

<?php

Disable Resizable Textarea Drupal 6

Drupal 6 allows textareas to be re-sizable and this may be a useful or annoying feature depending on how you look at it. It may be useful since you are allowed to change the size on the fly to suit your needs and may be helpful when adding a lot of content at one time. It may be a nuisance since an extra image (grippie.png) has to be loaded from the server to provide that functionality.

Drupal 6 - Adding an Above Comments Block to a node

At times it is necessary to add some content on a node but it should come before (above) the comments for that node. For example, you could want to display an advertisement or links for sharing or any other content like that.

Adding an above contents block can be done in 3 steps as shown below.

Open the YOUR-THEME-NAME.info file (located in the folder that belongs to your theme) and add the following line, ideally where the other regions are:

regions[above_comments] = Above Comments

Drupal 6 - Remove Homepage Textbox from Comment Form

To remove the homepage textbox from your Drupal comment form can be done easily using the instructions below. You may want to remove this textbox to clean up the default comment area that Drupal renders our of the box.

Just add the following lines of code to the "template.php" file which should be located in the directory of the theme that you are using. If "template.php" does not exist, simply create it.

You must replace "YOUR-THEME-NAME" in the code below with the name of the theme that you are using.

Drupal 6 - Remove / Hide Formatting Options Link in Comment Form

In this post, we show you how to remove "More information about formatting options" that Drupal places below the comment text area by default.

Just add the following code to the "template.php" file that exists in the directory of the theme that you are using. If the file does not exist just create it.

The code to be added is shown below:

function phptemplate_filter_tips_more_info()
{
    return '';
}

Remember to clear your cache after making the changes for best results. Hopefully this helps to clean up the comment area of your Drupal website.

Drupal 6 - How to Remove 'Not Verified' from Anonymous Comments

To remove 'Not Verified' from anonymous comments in Drupal 6, all you have to do is override an existing function. We do this by editing the "template.php" file (create it if it does not exist) in our theme folder and placing some code inside it. The tutorial below will show you how.

Note that you must replace THEME-NAME-HERE with the name of your theme in the function declaration. Note also the troublesome line that has been commented out to solve the problem: