Restrict acces of some pages to registered users

supersonicdarky - March 18, 2008 - 02:58

I'm new to drupal and am amazed by it's simplicity and power. One thing I seem unable to figure out how to do is to restrict access to certain pages. The user needs to be logged in to view it. Anonymous users just get a message saying "You need to login/register to view this page". Any simple way to do it?

Please remember I am noob and need specific instructions. :)

simple - it's in admin

zilla - March 18, 2008 - 03:02

go to admin/users/user permissions - there's a section for all 'nodes' and in it you'll see all sorts of option for users by column (one column for 'anonymous user' another for 'authenticated user' and others for any other user types you might create - like a new user with special rights.

in the row for 'access content' (should be the very top line in that section) make sure that 'anonymous user' is unchecked and only 'authenticated (registered) user' is checked - you can also drill down and restrict access to certain areas that you've enabled using this same screen (eg anybody can 'view forums' but only registered users can talk/comment, same for books, blogs,pages etc)

One way to restrict access to certain areas....

Lindagail - March 18, 2008 - 03:40

I'm still a novice, so someone might have a better way but...You could create a content type (Admin > Content Management > Content Types). Then create a role that has access to that content type (Admin > User Management > Access Control). Then once they have registered, assign them to that role. Create a view with that node type. (Admin > Site Building > View) I'm not sure how to get your message "You need to login/register to view this page." It seems like you could use an argument within the view having to do with User. Play around. In creating the view, within the "Page" area, there is an "Empty Text" text box. That might work.

Lindagail Roy
Native America OnTheWeb
http://www.naotw.biz

that's a lotta work for only 2 user types

zilla - March 18, 2008 - 03:56

sounded like he was saying, "if you aren't registered at my site you can't read stuff" and so i was suggesting the super simple approach: don't let anonymous users access content.

by default, if they try to view content and they're not allowed to, they will see a message that says, "sorry, you must be logged in or registered to use this feature"

creating new content types, new users, new views - that's more useful once you begin with tiers of access for more than one type of registered user...like what 'premium content sites' do..

[Subject]

supersonicdarky - March 18, 2008 - 21:39

I wanted to set permissions per page, not type of page. Just now I found what I was looking for: http://drupal.org/project/node_privacy_byrole

great find.. even i was

saitanay - March 18, 2008 - 21:42

great find.. even i was lookin for such a thing..

 
 

Drupal is a registered trademark of Dries Buytaert.