0

I need to make a basic page available to logged in users only and also need to retrieve information based on their login. I installed the Content Access module but it is not granular enough for me. Where would I modify the page that non-logged in users see?

Also, is there a way to store additional information in the user account such as an ID to our third-party database that we use to store user information? I will be retrieving this information to show in my first sentence above.

  • Are you using Drupal 6 or Drupal 7? In Drupal 7, you can store additional info in user accounts by going to Configuration -> People -> Account Settings -> Manage Fields. – Patrick Kenny Mar 6 '12 at 15:45
1

If it's a specific page on your system, create a page-----.tpl.php for it and put in there something like:

<?php if ($logged_in): ?>
  // do whatever you want for logged in users
<?php else: ?>
  // do whatever you want for anonymous users
<?php endif; ?>

If you are using Drupal 6, the http://drupal.org/project/content_profile module allows for all sorts of additional profile content fields. In Drupal 7 I am assuming you'd use profile2 but I am only now learning about D7 (mostly from answering D7 questions with D6 answers ;)

  • Since my theme already has a page.tpl.php I used this approach and gotten rid of the content access module. – MB34 Mar 6 '12 at 17:23
  • Yes, I'm using Drupal7 – MB34 Mar 6 '12 at 17:24
  • How would I test if user was logged in the xxx_preprocess_html function? – MB34 Mar 6 '12 at 17:32
  • Nevermind. I am going to use proprocess_page function instead. – MB34 Mar 6 '12 at 17:40
  • @MB34 Unless you plan on outputting two different things, using hook_init in a custom module would be a preferred solution. Backing this kind of logic into the theme is always a bad idea. – googletorp Mar 6 '12 at 17:48
0

It should be pretty simple to setup permission to allow only users with the authenticated user role access to the node.

  • As I said, it is not granular enough. It has "Access the content overview page" which I granted to non-authorized users. However, all it does is call the drupal_access_denied() function if they are not logged in. This shows the generic Access Denied page. – MB34 Mar 6 '12 at 15:38
  • These are the only options for a Basic Page: Basic page: Create new content Basic page: Edit own content Basic page: Edit any content Basic page: Delete own content Basic page: Delete any content – MB34 Mar 6 '12 at 15:39
  • @MB34 What exactly do you need another permission for with regards to content? Are you familiar with CRUD? – Clive Mar 6 '12 at 15:54
0

If it is granular permissions you need, I usually turn to Taxonomy Access Control (TAC) module. You can restrict which roles can view which nodes based on what terms are assigned to the node.
That is the most granular solution I've found.

Without extra modules you can restrict roles based on content type by setting the view permission to nodes of certain content type appropriately for each role.

  • Since they are basic pages, are they considered "nodes"? – MB34 Mar 6 '12 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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