Harry Slaughter's blog

Quick Drupal function reference


I got this little snippet off of drupal.org somewhere, but it's proving remarkabley handy for everyday development.

Create a php node with the following content:

"You are not authorized to access this page" checklist


This is a surprisingly common error for drupal users. Drupal has very powerful access control features, this is good. But it also means it's pretty easy to configure things in such a way that you prevent your users (usually the anonymous ones) from accessing content, this is bad.

I've run across this problem on many occassions, so I've put together a checklist that may help you debug your access problems.

  1. access control - Start here, does your user actually have access granted to him to view the content in question? Browse to your admin/access_control page and confirm that read access is granted for users on modules such as 'node'. If "access content" is not checked for anonymous users in the node access row, anonymous users will not be able to view any nodes! Check all the "access content" type values for all node types. Make sure they are the way you want them.
  2. User 0 - Make sure this user exists in all the appropriate tables. This is probably the most common reason for anonymous users being denied access. See my post, All Important User Zero, for more info.
  3. Make sure the author of the node(s) you are trying to view exists in your users table. There's currently a bug in Drupal in which if the author of a node can't be found in the users table, access will be denied to all for that node. To prevent this from happening, instead of deleting authors who are no longer part of your site, disable their account instead of deleting it.
  4. Make sure you're using the appropriate mysql extension. Check your settings.php file. If you're using "mysqli://" in your $db_url value, try using "mysql://"
I'm sure there was more, but I can't recall it now.

Well, that's it for now. As always, if you have any tips or ideas, please add a comment here.

redirecting all possible hostnames to one using mod_rewrite


SEO experts claim that having multiple hostnames point to the same site will result in lower rankings for that site. It's common to see sites accept both "www.foo.com" and "foo.com".

I have no idea if this is true, but it makes a bit of sense, so why take the chance.

I want to direct everyone to "devbee.com" regardless of what they type in, with one exception. I want to allow for a hostname test.devbee.com for my own devious purposes. This is what I'd put in the mod_rewrite section of my .htaccess or httpd.conf file:

module for managing multi-dimensional node objects


I've got a problem I'm trying to solve.

I want to a module to manage inter-related data sets.

Imagine a chain of retail stores that carry different products and have a multiple ongoing sales. We'll call the module "storemanager".

Each store will have its own properties along with various active sales and its own unique products. Each sale will have properties plus a list of products that make up the sale. One or more stores may have the same sale. Finally, products will have properties, and they may be present at one or more stores and in one or more sales.

Syndicate content