Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

What I want is whenever a registered user saves a page type node - that specific node should be made inaccessible to the user.

So if a registered user has save node/122, node/122 should be made inaccessible to the user.

How can I do it?

share|improve this question
Are you looking to remove view or edit permissions (or both) after they have created t? – user842 Jul 26 '11 at 3:41
yes all permissions so that the page is taken offline to all but admin – AgA Jul 26 '11 at 4:19

2 Answers

up vote 1 down vote accepted

Easy! When a new Page is created, just change its owner to a different user with appropriate role and permissions. In our case, let's say to admin.

First, install the Rules package, enable Rules and Rules Admin modules.

Navigate yourself to the Rules | Triggered rules | Add a new rule page:

Label: Detach page from creator
Event: After saving new content

Make sure the new rule is active. Save changes and on the next page Add a condition:

Select the condition to add: Content has type
Content types: Page

Save and Add an action:

Select an action to add: Load a user account
User id: 1

Save and again, Add an action:

Select an action to add: Set the content author
User, who is set as author: Loaded user

Done! This changes the node creator and the original author has control over it no more.

As you will see, this is just the quickest solution to your problem. Rules module enables you to go wild and achieve heaps of stuff that you would normally expect separate modules to be put together for. To get the idea, have a look at how I used Rules (in conjunction with Flag) to keep track of Recently viewed nodes in Drupal.

Note that the node creator always has view permission to the node, as long as they have access content, without which CMS wouldn't make much sense. Anyway, to keep track of the original creator, for display or so, you can use the CCK's User reference module.

share|improve this answer

For each content type that is associated with the Node module, the module defines the following permissions: create, edit any content, edit own content, delete any content, and delete own content. You can allow users with a role to create nodes of a specific content type, and not allow those users to edit those nodes; what the Node module doesn't allow is to forbid users with a role to view nodes basing of their content type.

If the question is how an administrator user can hide content from the ordinary users, then an administrator user can unpublish a node. This can be done in the node edit page, using the form fields in the "Publish options" field set; alternatively, it can be done from admin/content/node (admin/content in Drupal 7) selecting the nodes to unpublish and the "Unpublish" ("Unpublish the selected content" in Drupal 7) option in the "Update options" field set.

share|improve this answer
I mean as an user say user1 I can create node type Page and edit as well. But later admin may want to hide this page so as to make it inaccessible to the user who has created it( user1). For example when Admin has accepted the article submission so that the article is no longer available for the ordinary users. – AgA Jul 26 '11 at 4:22
I updated my answer. – kiamlaluno Jul 26 '11 at 5:16
Thanks but I was looking for hiding a page altogether from non-admin authors. Unpublishing does not hide them from their owner creators. In fact the article submitters will create articles only in unpublished states. – AgA Jul 26 '11 at 9:12
By default users cannot see unpublished nodes, if they don't have the permission to administer nodes; in that case, all they get when they try to view an unpublished node is an "access denied" page. – kiamlaluno Jul 26 '11 at 9:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.