Steindom, LLC is the company of Joel Stein, providing professional web development services for businesses of any size. To discuss your web development needs, please contact Joel at 314-481-4573 or via email.

Adding a prefix to all tables in a MySQL database

Here's a helpful tip for situations where you need to add a prefix to all of your database tables. Supposing that your database was called "my_database" and the prefix you want to add is "my_prefix", execute the following query:

Compiling a PHP Memcache extension with MAMP 2.0.3

MAMP came out with a new 2.0 version, and so it's time to update the memcache.so file (see my previous posts for MAMP 1.9.5 and MAMP 1.9.6). As before, you can either download the file, or compile it yourself.

A solution to "too many checkboxes"

Drupal's permission screen has loads of checkboxes. And if you've got lots of roles and you're using something like Forum Access, you'll find yourself clicking 'till the cows come home. Fortunately, there's an easy solution—CheckBoxer, a Google Chrome Extension.

Programmatically moving menu links from one menu to another

Here's a little snippet to move a menu link from one menu to another. For example, let's move the Contact Us link from the Primary Links menu to the Secondary Links menu. All you really need to know is the internal name of the menu where you want it to move to.

Exporting and creating field definitions in Drupal 7

I frequently export field definitions so I can programmatically create them in an update.php function. In Drupal 6, the CCK module came bundled with a Content Copy, but (so far) I have found no similar tool in Drupal 7. Here are the tricks I use to do this in a quick an relatively painless way.

Creating dates in PHP past 2038

I encountered a situation today where I needed to format a date which was far into the future (Anno Domini 2199). However, my standard approach of converting the string into a timestamp via strtotime and then formatting it with date produced weird results. In situations like this, it's best to create a date object.

Creating vocabularies and taxonomy terms programmatically in Drupal 7

Here's a little tip to create a vocabulary programmatically in Drupal 7.

taxonomy_vocabulary_save((object) array(
  'name' => 'Vocabulary Name',
  'machine_name' => 'vocab_short_name',
));

And, just in case you need to create a taxonomy term in your new vocabulary, you can do it with taxonomy_term_save. But first, we need to get the ID of the vocabulary we just created.

Creating a menu link programmatically

A friend of mine asked how to create a link programmatically in Drupal. I do this sort of stuff all the time, because one of the projects I help with requires us to write update scripts for our deployments. Let me outline two ways to do this, one via the Forms API, and the other using menu_link_save.

Beginner books on Drupal 7

One of my clients asked if there were any good beginner books on learning Drupal 7. Here are several I found... haven't read any of them yet, so I would recommend the one with the best reviews (as of this posting), which I'll post first.

Compiling a PHP Memcache extension with MAMP 1.9.6

Today MAMP 1.9.6 was released, but the PHP version is the same as it was on MAMP 1.9.5. That means you can use the same instructions (and the same memcache.so files) that I wrote for the 1.9.5 version.

Compiling a PHP Memcache extension with MAMP 1.9.5

Pages

Subscribe to Steindom, LLC RSS