access

Restricted content - Yet-another-but-different Drupal node access module

I previously posted about my search for my ideal content access module. Since then I've done a lot of searching and digging through the source code of all the most popular content access modules. I've come to realize there was really no module currently out there that had the features I was looking for. A quick review of the feature wish list:

  • Per-content access restricted by user roles
  • If the content is restricted to user, don't just hide the node, but rather show a message in place of the content like "Sorry, this post has been restricted to users with the following roles: registered user, friend."
  • If the current user is anonymous and the content is restricted, also show a message like "Please create an account to view this content." with a link to the user register page, of course.

restricted_content1 The built-in Drupal node access system is not really ideal for this direction since there's absolutely no middle ground between, "This user can view the node" and "OMG! Hide this node completely!" So today I started Restricted content, a yet-another-but-totally-different node access module. After only a couple hours of coding, it seems to be working fairly well, minus any kind of testing framework (I swear I'll get right on it webchick!). The content restriction messages shown to the user are customizable and can be integrated with token for some cool token replacement. For anyone daring enough to try it or even just take a look at the code, your comments and feedback are wanted and welcome here or in the issue queue. Hopefully some of you can find this useful like I have!

Perfect Drupal content access module

UPDATE: I have put my solution in a new module, Restricted Content, detailed in a later blog post.

I've been looking through all the Drupal content access modules for a nice module to use on my other blog, davenjenny.com. I've been looking for the following features:

  • Per-node access restricted by user roles
  • If a node is restricted to user, have an option to show a nice message like "Sorry, this post has been restricted to uses with the following roles: registered user, friend."
  • If the node is restricted to registered users and the current user is anonymous, also show a message like "Please create an account to view this content."

Probably the closest thing to what I'm looking for is the Node Privacy by Role or Content Access modules, but I'm almost leaning towards rolling my own module.

Syndicate content