I run a small business, and have created a website in Drupal 8 (should have used 7, bit late now, oooops).

Part of the website is designed to be behind a subscription, which I've got working and works well. Only problem is, the content types I want to only be visible to people who have paid, are visible to everyone.

I installed the Content Access module and have set it up thus:

Content Access Module settings

As you can see, "view any checklist content" is set as only "subscriber - bronze" which is currently the only role that'll need it.

When logged out, the page is visible; when logged in (as admin or a test account using that role) it's visible.

Content type when not logged in

Rebuilding permissions is a pain (~20k nodes), but using Drupal Console I can do so and it runs successfully, but no change to the page's permissions.

up vote 5 down vote accepted

I prefer to use Node view permissions for this. As long as all you are trying to do is control access to content types based to user type.

  • That's worked perfectly, thank you! – ChrisG Aug 22 '17 at 19:55

Maybe you want to give it a try to use the Group module, which allows for creating arbitrary collections of your content and users on your site, and grant access control permissions on those collections. It is available as of D7, and has a D8 version also. It creates groups as entities, making them fully fieldable, extensible and exportable. Every group can have users, roles and permissions attached to it (refer to "What are the various roles supported by the Group module?" for more details about that).

For this specific question, you'd enable the gnode submodule, and for each group type you would define the appropriate permissions (view, edit, delete, etc) for the various Content Types.

For the part of the website that is behind a subscription (as in your question), it seems that you would want to grant access to what, in Group, is called "Members" ("people who have paid" in your case). But you wouldn't allow access to that part of the website for:

  • "Outsiders" (= logged in users who are not a member of a group).
  • "Anonymous" (site visitors that are not logged it).

Resources

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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