template

User Access Example #1 - A Mostly-Private Site

We recently completed a site that offers only a small amount of anonymously-accessible content. I want to share the setup with you, as I feel it's pretty effective. The basic structure is as follows:

  1. Anonymous users can only see some pages (the ONLY content type they can ever see is Page; though this could change)
  2. Authenticated users can see most content, across most content types
  3. Client Admin users can see/edit everything
  4. If an anonymous user gets an "Access Denied" page, redirect them to the user login page, but maintain the original destination

Adding a Custom Token to the Ubercart Email Template(s)

In this post I'll show how to set up an extra token for use in an Ubercart template. This will require creating a custom module (because we don't really want to modify others' modules). We'll use a few different hooks to create the token, and then simply modify the template to include this token. This setup requires the token module (which is required by Ubercart), so make sure this is enabled!

Altering the basic properties of a Drupal textarea

The following example, when placed in your theme's template.php file, will shrink the size of all of the "body" textareas on your site to 5 rows, and set the textarea as resizable. The function we're using to alter the textareas is theme_textarea().

Add [Java]Script to a Specific Page

There are several ways to add javascript code to a page in Drupal. The method outlined below involves a modification to your theme's template.php file. You'll be editing (and un-commenting if necessary) your theme's preprocess_page function. This basically lets you modify the variables that are available in your page.tpl.php file(s).