‘code’ Archive

How to programmatically create and log in drupal users

Creating a new user is very easy in Drupal 6. Here’s how.
<p>><p>$new_user = array(</p><p>'name' => $username,<br /> 'mail' [...]

How to dump or export all the table definitions in a MySQL database

So you haveĀ  a database with loads of tables. You want the table definitions of all of them. You don’t really need the data. mysqldump to the rescue!

mysqldump -u USERNAME –password=PASSWORD –no-data –opt DB1 > DUMPFILE

That’s it! Easy as a pie The key here is the –no-data option. It dumps all the table [...]

Firebug opens automatically for all pages

Faced this bizzare issue today in Firefox. Firebug was opening automatically for all pages. Even on closing firebug, all I had to do was click on a new link in the same tab for it to appear again. This happened for all tabs.
Turns out I had accidently turned on “On for all Web Pages” option. [...]

Gravatar support in Drupal

If you’ve been using Wordpress you probably know about Gravatar. Gravatar is an abbreviation for “Globally Recognized Avatar”. It’s a service which provides an avatar across sites. While Gravatar support is built-in in Wordpress, it requires an external module to be installed in Drupal. Recently I had to use the module in a Drupal 5 [...]

Pirate tweet

September 19 is International Talk Like a Pirate Day.For this day, the Yahoo! Query Language (YQL) team announced on the YDN blog that they were bringing out a “pirate table”. This table would allow us to translate plain English to piratespeak using YQL. I had been meaning to play around with YQL a bit and [...]