I'm looking at making a site that provides a different 'experience' (to use the marketing term) depending on who the visitor says they are, without authentication. The functionality I'm thinking of using is to programmatically change the role from anonymous to something else.

So the from the launch page, client wants the site to look different depending on whether the visitor clicks "I'm a floor manager", "I'm a purchaser", "I'm a decision maker" and a perhaps few other choices. They are going to see different promotional material and copy depending on which link they choose, and the client wants it to appear that the whole site is geared towards them -- in other words, menus, pages, and promotional material not 'for' that user will be absent when they make that choice. It should look like several different sites, after they click out of the initial page.

So I thought that a way to do this would be to make all the content, menus, images, pdfs, and then assign access by role. That way, if you're looking at the site as that role, you only see the things relevant to you. But we don't want the users logging in -- they just click on a button to declare what role they are, and if they are tricking us, we really don't care.

Will I be able to do this in the way I am imagining?


Roles can be added to users who are authenticated users, which means they logged in. Anonymous users are only anonymous users; no other role can be added to them.

If you are just trying to show a page differently basing on the what selected from the anonymous users, then you can use a cookie to store a value that is used to alter the user interface. In Drupal 7 there are two helper functions that can be used to delete and save a cookie containing values for an anonymous user: user_cookie_delete(), and user_cookie_save().

  • This sounds like it would be a lot of work to have things (pages, menu items) display or not display, based on a user cookies. Would I accomplish this through a module, or how?
    – user1359
    Aug 16 '11 at 15:40
  • Could I have one user for each role and then just log in programmatically the appropriate user, with the wanted role, when they click on the appropriate link? Can there me multiple simultaneous sessions for the same user?
    – user1359
    Aug 16 '11 at 15:47
  • 1
    That would be a worse headache than changing the shown page basing on the content of a cookie. :-) There is just a session per each user; you cannot have multiple sessions per user, on Drupal. As far as I know, there isn't a module for that already, but you could create your own custom module that changes the page content basing on the values of one or more cookies.
    – apaderno
    Aug 16 '11 at 15:59

There are a couple of ways you could approach this without programmatically logging people in. A cookie is one. Another would be by taxonomy term - you can use the Contexts, Panels and/or ThemeKey modules to build out a custom look or even change the theme for a specific path or term.

Another way you could do this is through Organic Groups. Novell uses OG to define "user communities" (which sounds a lot like what you are talking about). Check out http://www.novell.com/communities/ and you'll see each group can have quite different information and look/feel.

If you anticipate these groups of users will eventually connect with the company online using OG may be the best choice.


I've tackled something similar to this in a different way using Domain Access module. Set up subdomains for each variation of the site you want, have a splash screen to let the visitor make their initial choice which then directs them to the appropriate URL. Then use content/block visibility to control what is displayed on each subdomain.

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.