Cross-posted at O’Reilly Broadcast.
The Drupal Content Management System keeps getting better and better. But the learning curve is still steep and the interface is still tricky – even after working with it for several years, some gotchas keep tripping me up. That tells me it’s worth jotting them down, hopefully to spare a few other Drupallers falling into the traps I’ve fallen into enough times for all of us.
This time: Mysterious problems logging in or accessing content.
These are fairly common and can have a variety of causes. The ones I’ve found most often:
1. You just need to clear your browser’s cache (I believe Drupal’s cache management has improved, so that this is less common in recent versions).
2. You haven’t given a particular user role permission to access a particular content type. Go to [yoursiteurl]/admin/user/permissions and make sure the appropriate boxes are checked (replace [yoursiteurl] with your actual site url, of course). Note that you need to do this every time you create a new content type (as when using CCK, the Content Construction Kit), or even when you are only adding a new field to a content type. Also note that giving a permission to Anonymous users does not mean that Authorized users inherit that permission. You have to check the box for each.
3. The SQL database has a problem. This can cause access or login problems even for the super admin user (user 1). Bearing in mind that you should back up your database before doing anything to it, you can try these fixes:
- Rebuild permissions: Go to /admin/content/node-settings/rebuild.
- Repair the Sessions table: You can use the appropriate SQL query for your DB, or an easy way is to use PHPMyAdmin. In PHPMyAdmin, choose your Drupal database, check the box next to the Sessions table, and find the “With selected” drop-down near the bottom of the page. Choose “Repair table”.
The Sessions table seems to be prone to problems. I recently came across this idea at Stanford Tech Commons for keeping it healthier. It sounds useful, but I don’t know enough about database innards to judge its reliability. Comments?