Display E-Mail Adresse of anonym visitors in Drupal-comments securely


Visitors post comments and they live sometimes their contact information like email address to get feedback. If you display e-mail spambots will catch them before other visitors. If you dont display, other visitors cannot send feedback. What is the secure anti-spam solution?

Here is what I did:

- email adresse of comment-poster will just partly shown to other anonym visitors (and with a tip to register to see full email)
- email adresse of comment-poster will shown to other registered visitors fully

How to hide / encrypt CCK Email field with JS against spammer

I got headche while searching for a filter to encrypt/hide email cck field to protect email addresses from spambots. I have installed , deinstalled, activated-deactivated rearranged input filters with both invisimail and spamspan but no luck! Finally I decide to change code in email.module. It works! Go and open "sites/all/modules/email/email.module" and find the line 115 like this:

 * Theme function for 'default' email field formatter.
function theme_email_formatter_default($element) {

Simple Hello World Module for Drupal 6

This is a small and simple "Hello World!" module for quickstarters who uses Drupal 6x series. We need just one directory and two files:

  • modules/simple_hello_world/
  • modules/simple_hello_world/simple_hello_world.info
  • modules/simple_hello_world/simple_hello_world.module


; $Id$
name = Simple Hello World
description = Description of Simple Hello World module
core = 6.x



Drupal 6 vs. Joomla 1.5 (2009)

Drupal versus Joomla!This is a comparison of most popular content-management-systems Drupal 6x and Joomla 1.5 series.

Drupal pros: free, professional coded, multilang, multisite, performance, great community, flexibility, power, role-based user access, flexible content types, excellent taxonomy system, seo friendly urls, multi-db-support

Fix Google Adsense Search and Drupal Conflict

Google Adsense internal search code does not work with Drupal sites normally. The reason is $_GET[q] conflict between both services. $_GET[q] means "current page" for Drupal and "search query" for Google. We can fix it with two easy steps.

Step 1:
Create a custom page like "websearch" etc under Drupal and add Adsense Code for results page.

Step 2:
Add this code at the top of your Drupal's index.php:

// Fix Drupal-Adsense conflict
$_GET[q] = ($_GET['cx']) ? "websearch" : $_GET[q] ; 

Delete all spam node entries of a spesific user on a Drupal site with PHP

Case: We have one or more spammer-user who added hunderts/thousands of nodes automagicly or manually. It takes very long time to delete them using Drupal admin interface. We need a fast & effective solution.

The solution
1. Find 'uid' of spammer
2. Create a block with input-filter PHP and run following code

$r = db_query("select * from {node} where uid='123456789'");
while( $arr = db_fetch_array($r) ){
	echo $counter++. " ". print_r($arr,1)." ";
            echo node_delete( $arr[nid] );

Mysql: update weight by an auto-incremented string created on the fly

I had a problem with Drupal6 by sorting tags. Mysql can sort or place some non-ascii letters correctly but PHP can not.

Example: I have a list of cities and I want to sort them by first letter. I want that "ívori" and "îwata" beeing listet with "Ibiza" under "i". PHP places both ívori and îwata after Z. To prevent this I update "weight" manually with mysql and sort them by weight instead of alpha.

select @my_temp_counter:=0;
update `term_data` set weight = (@my_temp_counter:=@my_temp_counter+1) order by name;

Sort Drupal taxonomy terms by custom weight

I have got a problem with Drupals taxonomy sorting alghoritm. I got a taxonomy group for authors. I created a block with tagedelic "tags in authors". The problem there was that tagedelic couldnt put in right place author-names starting with letters like é, í, ò etc.

To solve it. I exported all terms and edited them in Notepad++. I sort terms by alpha, gave them an automated line number. And combined line number with Drupals weight range (scala +49 to -49).

update term_data set weight = -49+\1/3 where tid=\2 /* \3 */ ;

\1 is line number.


"Problem with activation" : spam on Drupal 6

I habe a Drupal site and have a problem for a couple of weeks: I got automated forum topics named "Problem with activation" with a link inside my site like http://example.com/?somethinklooklikemd5

Why this is happens and how can I prevent it?

Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.