Monthly Archives: June 2009

Changed my WordPress Theme

I changed it to ‘Silver is the New Black’ because I like the flexible width, and the fact that my code samples show up well (at least, when viewing the blog at 1400 x 1050 on my Dell Latitude D610 15″ laptop.

However – I still don’t see my excerpts. Does anyone know of a theme hosted on that shows excerpts of posts?

How to make content private in Drupal

I’ve been playing around with a test Drupal install lately. I’ve installed Drupal version 6. One of the most challenging things about working with Drupal is knowing which plugins to use; there are so many of them. For example, in the User Access and Authentication category, there are 249 modules! It took me several tries before I found the module I needed, mostly because the purpose of each module I looked at is not particularly clear. Anyway, I wanted to have some content visible to anyone, and some only visible (and accessible) to authenticated users (me!). I created a story (recommended for newbies on the Drupal site, in the Drupal cookbook), which I wanted to be seen only by me. I also created a public story that anyone can read. Here’s how I protected my private content:

  1. Select a plug and download it. I chose the ‘content-access’ plugin. I found this via a circuitous route. First, I googled phrases like ‘secure content in Drupal’ and ‘Drupal protect nodes’ with little success. Then I went to Safari Books Online (I have a full library subscription, through work), and looked at the chapter on Modules in the Packt book appositely titled Drupal. This chapter discusses the ‘node_privacy_byrole’ module. I searched for it on, and read its intro, which explained that it is similar in function to the ‘Content Access’ module. So I then read about the ‘Content Access’ module, which has been kicking around for ages (since 2005), and decided to give it a whirl.
  2. I downloaded the module to my laptop. It’s a tar.gz file, so I unzipped it with 7zip.
  3. I copied the whole unpacked folder (called ‘access-control’) via FTP to my server. You always copy modules into the Drupal subfolder called ‘modules’, so that’s what I did.
  4. I logged in as Site Admin to my Drupal site.
  5. I clicked on Administer > Site Building > Modules. This presents a list of available modules, most of which are core modules, many of which are ‘active,’ but some not. My newly added module appeared at the top of the list, under the heading ‘Access Control’
  6. I checked the box next to Content Access. This makes the module active (usable).
  7. I then had to click a button to rebuild site permissions. You get a warning saying this might take a long time. In my case it took about 15 seconds – I don’t have much content yet.
  8. I clicked on Administer > Content > Content Types.
  9. I clicked on ‘Edit’ next to ‘Story’. This option means I am about to edit the settings for any content type of ‘story’. I currently have two stories, so the options I selected here will affect both of them (and any other ones I create later).
  10. A new tab (ie one not seen in the core install) appeared, called ‘Access Control’. I clicked on it.
  11. I clicked the ‘View any content’ options for both anonymous users and authenticated users. This may seem counter-intuitive, since I want to deny anonymous users the ability to view some stories, but basically this sets the default to ‘Allow all’ and allows you to granularly deny access. Read on…
  12. There’s a heading on this page: ‘Per content access control settings’. I checked the box next to the text ‘Enable per content node access control settings’ – meaning I can control, at a node level, the access settings for any story. Since all content in Drupal (AFAIK) is a ‘node’ (or collection of ‘nodes’), this seemed to make sense.
  13. I saved the settings.
  14. I clicked on Administer > Content Management > Content. This showed me a list of content on my site – a couple of stories, some Book pages, a Page and a blog.
  15. I clicked on ‘Edit’ next to the story I wanted to make private (accessible to only authenticated users – me). This is the only option available at this point, and it placed my story in edit mode. However, a new link now appears above the story: Access Control.
  16. I ignored the fact that Drupal seems to think I want to edit content rather than permissions, and clicked the aforementioned ‘Access Control’ link. Jolly good. Almost done.
  17. I unchecked the boxes for Anonymous User under the column headings ‘View any content’ and ‘View own content’ (the second uncheck is probably not necessary, since Anonymous will never be able to add any of his/her own content to this story anyway – but what the heck.
  18. That’s it. I tested the results by logging out. Sure enough, I could no longer see the story on my front page (I have a ‘story’ block visible on my front page for both anonymous and authenticated users). I could still see the public story, though, just as I wanted. I also tried cutting and pasting the URL for the story node into the location bar of the browser- still couldn’t get there! Perfect!

    An interesting side note- I’d also earleir installed a module called Secure Site, hoping that it would do the trick. It mentions something about ‘secured pages’ in the documentation, but I couldn’t for the life of me find a definition for ‘secured page’ anywhere on the site. However, after applying the access restrictions as described above, the Secure Site module dutifully kicked in when I tried going directly to the private story via its URL. So that’s what a ‘protected page’ is- one that’s handled by an ‘Access Control’ module.

My Favorite FireFox Plugins for Web Development

  • Firebug – debug your applications. An absolute must. Best features:
    • Debugger – step through, over, etc.
    • Console log for monitoring AJAX interactions -shows parms sent, data returned, round-trip time.

  • Web Developer – fantastic CSS diagnostic support. Best features:
    • View generated source – important if your script modifies the original DOM of your page
    • Display Element Information – shows all the properties of an element in a convenient popup. To use, press Ctrl+Shift+F or select menu Information/Display Element Information
    • Edit CSS – lets you edit the CSS selectors in real-time, and shows you the results – almost as you type
  • MeasureIt. Lets you find the height and width of any element or area of the page, in pixels. Helps diagnose CSS issues, for example, when you use combinations of margin, width, padding and border attributes.
  • Codeburner from Sitepoint, one of my favorite online journals ( Integrates with Firebug to provide comprehensive cross-reference information on HTML and CSS. Best feature:
    • Browser compatibility tables