I would like to set role for anonymous user.
For example :

The anonymous visit page A => set role A for this anonymous
The anonymous visit page B => set role B for this anonymous

And I would like to manage this role like the other (normal role).

There is a module for this ?

I would like to do zero dev for this.

TIA for you help


what are you trying to do plz can u explain more?

I want to display different block for different anonymous users for the same URL.
So I have to distinguish users.

For example :

Anonymous user A go from page 1 to page 3 then I display block X.
Anonymous user B go from page 2 to page 3 then I display block Y.

So I would like to assign a different role for these anonymous users to control blocks.

Do you understand ?

Why not just use query string variables? Page one's link would look like: page/3?[id]=A, then Page two would look something like: page/3?[id]=B. The block would then display based on the id value (or whatever you call it).

I would like clean URL.

And it's not only a block restriction.

I would like to control the menu item (with the module 'Menu Per Role')

How would you decipher one anonymous user from another?

When user visit a specific page.

Take the example :

Anonymous user A go from page 1 (he take the AA role) to page 3 then I display block X (thanks to his AA role).
Anonymous user B go from page 2 (he take the BB role) to page 3 then I display block Y (thanks to his BB role).

These roles allow to display differents block and to restrict item visibility per role.

So I'm looking for solution to assign role to an anonymous user but I think it's impossible.

(The solution can be developed by me)

You have no way of differentiating one anonymous user from another, therefore you cannot assign some anon's one role, other's a second, and the rest none.

Instead of regular links you could use a form (the front end user would not know the difference) and pass through hidden post variables to determine which block is shown (if you want keep the URL's clean).

Ok. I understand.

Any way to use cookie to do this ? But I can't use it to allow an article, block or more...

You can use PHP Sessions, but you would need javascript to to active an onclick event for the link, and set up the function in the template.php file.


I am interested by this solution (form).

But how to decide to show or hide block with post var ?

If the block is a view you can use the views_php module to add a Global: PHP field to check which value is present, then show/hide.