Quicklinks


drupal

Spotted at DrupalCon, Barcelona

Yep, I was there! :)

Group shot of the geeks at DrupalCon Barcelona (2007)

Picture used without permission. Originally spotted on Dries' blog

© Ana Calv

Drupal Tip #7: User 1

Drupal version: all
Module: n/a

Using user 1 as the admin user of a site during development seems convenient, but I've found myself overlooking and forgetting tiny things. Eventually, going back to a live site to set permissions, or change input formats, etc overrules the amount of time spent setting up a decent administrator role.

User 1 has permission to do absolutely anything on the site - so testing can have inaccurate results.

Some internet bad-guys can do some nasty things to the website, or even webserver, should they get their grubby paws on the identity of user 1, which is why I am a bit of a full-HTML-nazi. Also why I don't trust WYSIWYG editors as far as I can throw them. Best make sure there's no chance the user 1 username doesn't have a chance to be published anywhere, by forgetting a posted by, or allowing access to profiles for anonymous users.

Use your power for good and not for evil!

The Cobbler's Brother

The cobbler's son might have no shoes, but the youngest can live on hand-me-downs. ÜberEllis.com presents a new theme (yet to be named, see below):

The Default Colour theme screenshot of UberEllis

Yeah, I know - not exactly the best theme for a blog.. I've developed this theme for SWiTCH WebStart.

The theme utilizes the color.module, that comes with core of drupal 5 (Seen in the likes of "Garland" and "Minelli"). The aim is to speed up the design process for new clients. This way, implementation of functionality and "theming" can run concurrently for rapid deployment. :)

Here are screenshots of some of the presets in Unnamed.Theme:

Chocolate, Milkshake, and The Blues

The concept of Color.module is quite ingenius. It uses a simple php file to render some areas of solid colour and a gradient fill. Overlayed with a transparent .png file to make a composite, which is then sliced to create the images needed for the theme.

Despite a couple of limitations (I'm assured color.module 2 will eradicate these), it can be planned well, and certainly is a whole lot of fun to play with.

The cobbler's son

I've finally upgraded the ÜberEllis.com platform to Drupal 5. The jump from 4.7 does have some impact on some of the theme functions, and thus I'm running the new Garland theme that comes standard with Drupal 5 and up. When my career leaves me some free time again, I'll upgrade all the ÜberThemes to be compatible with 5, so apologies to all registered users who may have selected an older theme.

In the meantime, the cobbler's son will have to go barefoot ;)

Presenting: UberWeiss 2 - A qub based theme

By popular demand - the next release of UberWeiss - A new base theme for drupal.

This release has a far more condensed style (a little better planned). Also now supports secondary link action and a header block area.

UberWeiss 2

If you base a theme on this one, please leave the credit at the bottom of the page.

Drupal Tip #6: MySQL 4.0 and MySQL 4.1

Drupal version: n/a
Module: n/a

I've run into several issues running different versions of MySQL between development server and live server.

The following tip from a thread on drupal.org:
dump 2 versions of the database

For version 4.0, it would be:

mysqldump --opt --compatible=mysql40 -v -u DATABASE_USER -p DATABASE_NAME > database.40.mysql

For version 4.1, use:

mysqldump --opt -v -u DATABASE_USER -p DATABASE_NAME > database.mysql

I've learnt something new with regards to dumping databases for different versions of MySQL - A source of many grey hair in the past..

Often, once a 4.0 database has been imported into a 4.1 server, the following error message is common:

Warning: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation 'like' query: SELECT * FROM access WHERE status = 1 AND type = 'host' AND LOWER('IP Address') LIKE LOWER(mask) in \includes\database.mysql.inc on line 120

To get by this, you need to convert the character set of each of the tables (this solution courtesy of Willie):

ALTER DATABASE {DATABASE_NAME} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

And then:

ALTER TABLE {TABLE_NAME} CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

for each table in the error message.

For the reverse, editing the dump file can have pleasing results:

  1. Search for ENGINE=MyISAM and replace with TYPE=MyISAM
  2. Search for DEFAULT CHARSET=latin1 and replace with nothing Note: the character set might be something else, like "utf8"
  3. Search for character set latin1 collate latin1_bin and replace with nothing Note: the character set might be something else, like "utf8"

Drupal Tip #5: Primary links ++

Module: menu.module
Drupal Version: 4.7.2

Drupal version 4.7's menu module (core) allows context menu's as Secondary links.

To do this, set the menu settings (admiinister > settings > menu) to "Primary links" for both primary links and secondary links. A child link of a Primary link will become a secondary link when the primary link is active.

Drupal Tip #3: 403 and 404 errors

Module: Drupal core
Drupal Version: 4.7.2

Instead of using the default drupal error handling settings (administer > settings > error handling), consider using user/login as the default 403 page (instead of a node), or consider writiing a script that uses the referrer of the error (for 404) and passing onto the search module.

This tip brought to you from DrupalCamp.

Drupal Tip #4: Crontab

Running "crontab -e" (without the quotes) opens the crontab file where you can set times cron needs to run, if you have the correct access to the server.

With crontab, one can run any command one wants - for drupal, you need to execute cron.php
e.g:

#m h dom mon dow command
00 *  *   *   *  links -dump http://www.uberellis.com/cron.php > /dev/null

where:
m = minutes
h = hours
dom = day of the month (1 ... 31)
mon = month of the n(?) (1 ... 12)
dow = day of the week (0 ... 6) - Sunday = 0
command = the command you want to run at given time

This example will run cron every hour, ie. on minute 00

Other ways include - curl and wget - Drupal includes some script files in the default tarball showing examples of what commands to use for some.

DrupalCamp starts today!

It's finally here - the first DrupalCamp in South-Africa. DrupalCamp Johannesburg

Here's a list of what will be covered in this course.