Drupal
Setting up email subscriptions and notifications in Drupal 7
Drupal Level: Beginner-Intermediate
Email notifications are the glitter of community sites: very few people passionately like them, but you'll never get rid of them. Probably the most typical use case on a Drupal site is to send an email notification to let a node's author know that someone's commented on their node. I just spent the good part of an afternoon setting this up on a Drupal 7 site, and thought I'd pass along some time saving tips.
Knowing Your Body and Practicing Safe CSS
This is a quick trick I picked up to guarantee that any css changes you make only affect what you want.
There are different ways to identify the page you need to change. I tend to use url as it's always unique.
Here's how:
Locate the template.php file for the theme your working on and add something like this to the page_preprocess function
- function your_theme_preprocess_page(&$vars) {
- // Add a custom body class for specifc page
- if ($_REQUEST['q'] == 'example/page/new-body-class') {
- $vars['body_classes'] .= ' custom-body-class-name ';
- }
How to use Apache's Proxy on Drupal's Files directory
Drupal's files directory can get enormous, and it's best not to keep it in version control. Here's a way to use Apache's proxy module to point your local environment directly to your dev/live site's files directory so you don't have to download it.
In your httpd.conf:
- ProxyRequests On
- ProxyVia On
- <Proxy *>
- Order deny,allow
- Deny from all
- Allow from localhost
- Allow from all
- </Proxy>
- <Location /sites/default/files/imagecache/>
- ProxyPass http://dev.yoursite.com/sites/default/files/imagecache/
- </Location>
Quick steps to debug your module's css
Someone on the Drupal Dev list asked what to do when his custom module's CSS wasn't showing up. This is the quick checklist I sent in reply:
In order:
0. Make extra-sure your module's enabled on admin/build/modules
1. Check your drupal_add_css()
call. Should look roughly like:
drupal_add_css(drupal_get_path('module', 'MYMODULE') .'/css/MYMODULE.css');
2. Make sure you're doing drupal_add_css()
inside hook_init()
How to use a mailing list
When you reply to someone on a mailing list, your mail software will populate the "To:" address one of two ways: either to the person who wrote the post you're replying to, or to the entire list. This depends on how the list is set up.
There is a very simple way to determine if you're replying to a person or to the whole list (which might be bad if you're giving out your rates). Follow these three simple steps to avoid failing at mailing lists:
1) Read a message.
Howto: Lavalamp menu in Drupal 6
Today I got a tweet from @ChristianHudon who had seen our Lavalamp menu implementation on b4blinds.com:
@entendu I love this menu: http://www.b4blinds.com/ Care sharing howto?
So, Christian, here's how to:
First, javascript
Go snag the jQuery Lavalamp plugin and drop it in your /misc
directory.
DrupalCon SF is here!
Bright Bacon is getting ready to represent at DrupalCon SF! We can't wait to see all the new ideas and creative energy in San Francisco. We're all stocked up on Red Bull and 5 Hour Energy and ready to make this 72 hours of awesome.
If you're looking for some Experienced Drupal talent, Erik and I will be there all three days, and the job fair on Tuesday night. Let's meet!
