drupal

Drupal: how to clear the filter cache

Submitted by fabio on Tue, 2008-07-15 16:10.

A filter is a Drupal feature, usually implemented by some contributed modules, which substitutes parts of a node text with some other text.

Eg: if you use the Path filter module you can insert links like:

<a href="internal:node/25">hello!</a>

and the string internal:node/25 will be substituted by something like http://www.example.com/node/25 where www.example.com is your website url.

Drupal 6: get parent nid of a book child page

Submitted by fabio on Fri, 2008-06-27 18:07.

I had to get the parent nid of a book child page for a website which already uses Drupal 6.

Seems that the book module logic has changed deeply between version 5. The new stack implementation of the parent-child relationships is pretty complex, at least for me. I have to say that I did not studied it a lot thought.

So.. this is the code to do that:

<?php

if(isset($node->book)) { // book page
      $parent = book_link_load($node->book['plid']);
      $pid = $parent['nid'];
}

?>

Hope this helps.

A firefox search plugin for Drupal 6 apis at api.drupal.org

Submitted by fabio on Wed, 2008-06-04 13:41.

Some time ago I created a api.drupal.org firefox search plugin for Drupal 5.x and submitted it to the Mycroft Project for indexing.

Well, I've been requested to do the same for Drupal 6 Apis.

So.. I did it. There is now a Drupal 6 Apis search plugin available at Mycroft.

You can get it from the list of search plugins I created.

Disable related videos on a embedded Youtube player

Submitted by fabio on Thu, 2007-08-23 12:19.

Youtube recently added a new feature to the video player used to embed Youtube videos on other website.

The new default player, once the video completes playing, will display a list of related videos.

While this feature could be useful for some users it is probably not wanted on Youtube video aggregation websites.

Fortunately it's possible to disable related videos.
Let's see how.

Video module rewrite: update

Submitted by fabio on Thu, 2007-07-19 09:01.

The work on the new version of the video module continue.

I'm at a good point in the development and I think I will be ready to release the new version soon.

I attach here the current development version.

The code is still really unstable so.. do not use this on production. The update from previous versions still does not work.. so use this on a clean drupal install.

Go PHP 5! Go! Go! Go!

Submitted by fabio on Thu, 2007-07-05 21:28.

PHP is a very good programming language for creating web application. As an example Drupal is written using PHP.

Unfortunately, while already 3 years ago the PHP version 5 has been released, this version is still not yet supported by most of web hosts.

This is really bad because web developers have to stuck with PHP 4 witch is now 7 years old and obviously has few and ugly features compared to PHP 5.

Understanding drupal hook_nodeapi execution order

Submitted by fabio on Thu, 2007-06-28 18:22.

To solve a really ugly bug of the video module I had to track down, in a very detailed way, what was the hook execution order in the Drupal 5.x hook_nodeapi. Unfortunately I didn't found any detailed documentation of this neither on the handbooks nor in the developer documentation (on CVS).

This is why, armed with a lot of patience, I wrote down what happens at every content submission/previewing/loading.

Those are my results:

node submit (validation successfull):
prepare form validate submit insert

Video module: major rewrite status

Submitted by fabio on Thu, 2007-06-28 18:06.

I'm currently working on a major rewrite of the video module. It was absolutely needed as the code was pretty ugly and buggy.

The rewrite tries to simplify the UI and the content submission process.

Attached you can find my latest version, is super development code but it's there only to let you have an idea of the path I'm following.

The only modules which I tested are: video, video_ffmpeg_helper, google video, weblink video, upload_video, url video, youtube video. Any other will not work.

The last version (at the time of this post) is attached below.

Flash Support for Drupal Advertisement module

Submitted by fabio on Tue, 2007-06-12 17:49.

I just completed the development of a flash plugin for the Advertisement module. The plugin is available here.

With this plugin you can add flash ads to you Drupal website and track different stats for it.

It is also able to override hardcoded urls in the swf files. Then is it possible to track clicks on those files. This feature uses some swf url convertion code from the Openads project.

Fighting spam comments with Drupal

Submitted by fabio on Sat, 2007-04-21 10:05.

During the past weeks this site has been targeted by some bots which posted spam comments.

As soon as the spam comments appeared I started deleting them using Drupal comments administration however, as a spam comment was received every 2-3 hours, this was not an affordable way to keep my website spam free.