• Development

    db_query() and db_placeholders() example #1

    Have you ever wondered how to properly build a query like this in Drupal:

    This requires the use of db_placeholders() to create the placeholder ‘ ‘, ‘ ‘, etc.

    where $node_types is an array of node types.

  • Development

    Automatically create a Drupal node when a user registers

    Sometimes projects come up that have requirements that cannot be solved with an out-of-the-box Drupal install. A project I worked on some time ago required that I store a node every time a user registered for an account. The details of the project are a little fuzzy for me now, so I’ll just skip right to the example.

    This example shows how simple it is to programmatically create a node, and also shows the proper way to hook into the user system.