Drupal error fix: Fatal error: Unsupported operand types in ../common.inc on line 1426

If you`re using drupal, you might encounter this error, when upgrading to Drupal 6.16:
Fatal error: Unsupported operand types in path_to_drupal/includes/common.inc on line 1426
It happened to me when I tried to create a node that is unpublished (“Published” checkbox is unchecked) or trying to unpublish a published node.
There various modules that conflict with the 6.16 drupal core common.inc file which is changed in 6.16.
This is a fast fix of core file and it works for me.
Open up the includes/common.inc file, search for:

function url($path = NULL, $options = array()) {

(around line 1418)

Replace this code:

$options += array(
'fragment' => '',
'query' => '',
'absolute' => FALSE,
'alias' => FALSE,
'prefix' => ''

with this:

if (!is_array($options)) {
$options = array();
$args = func_get_args();
if (isset($args[1])) $options['query'] = $args[1];
if (isset($args[2])) $options['fragment'] = $args[2];
if (isset($args[3])) $options['absolute'] = $args[3];

Search for this line:
function l($text, $path, $options = array()) {

Replace code:

$options += array(
'attributes' => array(),
'html' => FALSE,


if (!is_array($options)) {
$options = array();
$args = func_get_args();
if (isset($args[2])) $options['attributes'] = $args[2];
if (isset($args[3])) $options['query'] = $args[3];
if (isset($args[4])) $options['fragment'] = $args[4];
if (isset($args[5])) $options['absolute'] = $args[5];
if (isset($args[6])) $options['html'] = $args[6];

Save the common.inc file, you should be done!
Tell me if it worked for you!


Just made a simple page for product “TurboXS KnockLite“, an engine knock (detonation / pre-ignition) warning light. Simple 3-page website, the domain was available, so I just made and informative page with description, installation instructions and links to online shops. If Google will like my site, I`ll add some AdSense banners and put referral links to online shops..

Add or remove trailing slash in URL with .htaccess

If you`re using some kind of CMS, usually its normal that each URL works with or without trailing slash, e.g. these URLs would be the same:

Still Google, Yahoo, MSN and other search engines treat them as different urls and gives penalty as they are dupliate URLs with identical content.
You have two options – to add or to remove the trailing slash. After a bit of reading I chose to remove the slash from my celica site, because I`m using Drupal CMS that removes trailing slashes for new content and I don`t really want to hack the CMS plugins. To alter the URLs, you need to edit .htaccess file at the root directory of your website ( http://example.org/.htaccess )
Add this code to your .htaccess file to remove trailing slashes:

#get rid of trailing slashes
RewriteCond %{HTTP_HOST} ^(www.)?turbocelica\.lv$ [NC]
RewriteRule ^(.+)/$ http://www.turbocelica.lv/$1 [R=301,L]

or use this code to ADD trailing slash to the end of each URL:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)([^/])$ http://example.org/$1$2/ [R=301,L]

Make sure you backup your .htaccess file before you edit. It`s easy to get “500 Internal server error” if you don`t know what you`re doing ;)
Read more here: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Drupal imagecache and robots.txt

Today i discovered a very stupid configuration in Imagecache module for Drupal. Imagecache saves all presets (thumbs, big images, etc) in subdirectory /sites/default/files/imagecache/[presetname]/. Of course this is conflicting with robots.txt, which says “Disallow: /sites/”. I created a few sites that really are targeted for Google`s image search, but I couldn`t find a single pic in google. This is so annoying to find out. I just removed the deriative in robots.txt and will update this post with results soon.

Turbo celica.lv

toyota celica st185Just created a page for my car: Toyota Celica ST185 (AWD Turbo). (Go google, fetch it nicely)
Since i`m taking a lot of pics while doing repairs and tuning, it could work out good for SEO when people search for images through Google. For now its pretty basic site, but i will spread it into different sections – articles on repairs, tuning, photo galleries by tags, etc. Well, just because.
Site is based on drupal. I love it!

How to: Disable new user registration in Drupal

How to: Disable new user registration in DrupalAfter a quick search I didn`t find how to simply switch off new user registration in Drupal. But it has even better feature – access roles. You can specify what usernames/emails/hostnames can access the members area or even register as user.
To disable new user registration, you have to add access rules for existing users. Go to yoursite.com/admin/user/rules/ and add a new rule. For example, first add an allow rule for user “admin“. Then for other existing users. After you have finished, add a deny rule and write “%” in the username field. This will allow to login only the allowed usernames and deny everything else. If the username is not defined it cannot be also registered.
You can even make private site and say to your friends add e.g. “-foo” to their usernames. So you make an allow rule with “%-foo” in username field.
The reason I need to block new user registration is spam. New users register everyday with random spam usernames.