Total page hits/unique visits snippet

Filed under:  Google about "Drupal" |  Google about "PHP"

I just thought it would be nice to share how do I display the total page hits and unique visits counter on this site's footer.

The following is a small code snippet that you can place wherever you wish, for instance on a block or a PHP template. Of course, you can change the message or customize the look to suit your needs. :-)

// please, enter to view the snippet

It uses the Drupal functions variable_get and variable_set to store the data. There's no admin interface to manage these variables. If you want to modify or remove them, you need to edit the drupal variables table.

Functions used to format the counter: (PHP) number_format and (Drupal) t and format_date.

Drupal page titles like breadcrumbs

Filed under:  Google about "Drupal" |  Google about "Search engines"

The page title is one of the most important pieces of information that search engines display on their results page, for any given search query. Choosing the right title for your pages, articles (or posts of any type) is probably a key factor that may lead users to choose your site ...or just jump to somewhere else.

By default, Drupal displays the site name and the page title, which is nice. However, any given page title you need to write is probably based on the context where it is published. So that alone might be misleading if it is not seen within the correct context. That is, in some circumstancies (say a book page, taxonomy based reports, etc.) only the title might not be enough.

On the other hand, Drupal has another pretty nifty feature, the ability to build breadcrumbs based on context. That's almost perfect, for what I was trying to accomplish. All we need to do is build the page title based on the current active breadcrumb and append the page title.

I thought I could share the code snippet I'm using on this site, so you may try it and see if such a small change can be translated into more visits coming from search engine queries.

Theming the Akismet spam counter

Filed under:  Google about "Akismet" |  Google about "Drupal"

If you are happy with the job being done by Akismet, then you may wish to display a link back to the Akismet site. To do so, the Akismet module for Drupal comes with the "akismet spam counter" block and a number of options that you can use to customize how it looks. There are also some hidden features behind this block that I would like to document here. First, I would like to mention the obvious features, then I'll try to describe how is it possible to display this information exactly as you wish.

Akismet module v1.1.2 for Drupal 4.7

Filed under:  Google about "Akismet" |  Google about "Drupal"

As soon as version 1.1.0 was released this site was visited by a nice spambot and I realized that there were a couple of minor bugs in the spambot detection code. Rather than waiting for some time to see if more bugs arise I decided to fix and release it asap. Those of you who are running v1.1.0, all you need to do is update the script akismet.module with the new one, which makes the upgrade path really simple. Hence version 1.1.2 is out.


  • Fixed bug: Do not apply anti-spambot checks if there have already been errors detected in the form.
  • Fixed bug: Do not check for empty body/mail in anti-spambot prevention code.
  • Added a function to expand the SQL query used to match spambots. This is hopefully better, for debugging purposes.

Installation and upgrade instructions are provided in the file INSTALL.txt included in the package. Only the script akismet.module has been changed since version 1.1.0.

Akismet module v1.1.0 for Drupal 4.7

Filed under:  Google about "Akismet" |  Google about "Drupal" |  Google about "Open source"

Although it took me a bit more time than expected, I'm happy to say that Akismet module version 1.1.0 for Drupal 4.7 is here.


  • Added experimental feature: anti-spambot options to prevent from Denial of Service (DoS) caused by certain spambots.
  • Rewritten moderation queue. It is now a bit more powerful, allowing operations against multiple items.
  • Code related to admin and cron has been moved to external files which are only loaded when needed. This is to minimize resource consumption during normal site operation.
  • Prevent from sending e-mail notifications to the same user who has written the content.
  • Removed unnecessary code in hook_install.
  • Added a couple of columns to the {akismet_spam_marks} table to speed up some queries. Requires running http://site/update.php

For further information, please check out the files README.txt and INSTALL.txt included in the package.

Ideas for fighting spambots

Filed under:  Google about "Akismet" |  Google about "Drupal"
Akismet module for Drupal

Well, the Akismet module has been released and announced today and I'm just getting some food for testing thanks to a spammer who decided to bomb this site for a while. If you (spammer) read this I would like to thank you again for that... not only because Akismet worked like a charm, but also because you have made me think...

Ok, I decided I'll finally enhance the moderator panel to convert it into a form so it will be possible to operate on several items at a time (to remove spam or simply to correct false positives sending information back to akismet). I can actually do it by a simple code snippet now, but probably akismet module users would love to see this, besides getting advantge of the current cron functionality that may remove detected spam automatically, so... expect that soon. ;-)

But that's not all... what if I add an option to generate a delay (or a ban) when spam is detected, before sending the response to the spammer? Well, they may not need to wait, so... what if I add this delay (or ban) to all requests to posts made by known spammers? I'm not thinking about permanent actions, just a measure to prevent from getting attacked by spambots. For permanent actions, there are other options such as .htaccess bans, Drupal access rules, the troll module and so on...

If you have ideas on that direction, please share them here... or is it ok as it is?

Akismet module v1.0.0 for Drupal 4.7

Filed under:  Google about "Akismet" |  Google about "Drupal"
Akismet module for Drupal

After several days of work and tests here at phpMiX.org, I'm proud to announce the immediate availability of about 2000 lines of code compiled into Akismet module v1.0.0 for Drupal 4.7.

You are encouraged to visit the Akismet site to learn more about it. In just a few words...

Protected by Akismet

Filed under:  Google about "Akismet" |  Google about "Drupal" |  Google about "Open source"
Akismet module for Drupal

This site is now running live a module that uses Akismet to check for spam in real time. This is something I starter to write a few months ago, but I had to delay because Drupal 4.7 was not stable enough. But now it's been a few weeks it was released, and it seems I'll have some spare time this week, so I decided to blow off the dust on that folder...

It currently checks for spam in comments. I need to finish the hooks for checking nodes (in Drupal jargon it is normal posts, books, etc.) and add a report or something for the admin side of the site.

I have commited to CVS what I have right now, if you wish to check...

Syndicate content