2

I have a site with content for two different user types: primary and secondary. I want to publish and unpublish some content depending on whether the current user is anonymous user, user primary or secondary user.

If the current user is an anonymous user:

  1. to publish primaria/docentes
  2. to publish secundaria/docentes
  3. to unpublish primaria/docentes/kit
  4. to unpublish secundaria/docentes/kit

If the current user is a primary user:

  1. to unpublish primaria/docentes
  2. to publish primaria/docentes/kit

If the current user is a secondary user:

  1. to unpublish secundaria/docentes
  2. to publish secundaria/docentes/kit

I try to do this with the the Rules module. The result of my configuration is this: - In the computer 1, I login as a primary user. Everything works fine. - In the computer 2, I login as a secondary user. Everything works fine. - If I return to the computer 1, the things are not good. I see that everything works as if logged in as a secondary user.

My settings do not respect the rules for the user already logged on. Every time someone logs on to any part of the world, that user settings apply to all other users in the world.

Please help me. I attached screenshots of my settings. :(

All my rules: enter image description here

Log in as an anonymous user.

When primary user logs.

When primary user logs off.

2
  • 1
    Sounds like what you want is different access permissions (ie: an anon user doesn't see primaria/docentes/kit but a primary user does) instead of publishing states, which are global (ie: no one can see vs anyone with the appropriate access permissions can see). Commented Nov 2, 2015 at 19:36
  • OK. I did not know that publish and unpublish are global actions. You're right: An anonymous user can not see "primaria/docentes/kit". But a primary user does. @ErinMcLaughlin, thanks for your support. I follow the direction of No Sssweat. Commented Nov 3, 2015 at 13:01

1 Answer 1

3

Publishing and unpublishing is not the way to go.

Step 1)

Install the Node Access module and give access to each node or content type accordingly, this way people can't share direct links with other users that have a different role.

Step 2)

What you need is to create 3 different view blocks

One for anonymous which lists primaria/docentes & secundaria/docentes nodes.

One for primary which lists all the primaria/docentes nodes

One for secondary which lists all the secundaria/docentes/kit nodes.

Hopefully node access module lets you filter your view by node access. Otherwise, you'll need to make the "kit", "primaria" and "secundaria" be a different content types so then you can filter by content type in your view.

Use view's access to role and select the role you want to be able to see the view. (see picture below)

enter image description here

Then you place all 3 view blocks wherever you need them (home page perhaps?) and since you have the view access by role, they will only see 1 view (the one they have access to).

1
  • It works now! Thanks @NoSssweat. I did not use Views. Everything worked only with Nodeaccess module. Commented Nov 4, 2015 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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