Selling Content with Drupal Commerce using Content Access and Roles

In this screencast we'll use Drupal's built-in access control mechanisms (using the Content Access module) to grant access to premium content to users who have a "premium" role.

Here's the recipe:

  • Enable Content Access and the ACL (optional) module.
  • Create a role called "premium"
  • Create a content type called "Premium Content" and put some great content in it.
  • Verify that users can only access the premium content if they have the premium role.
  • Create a product representing the premium role.
  • Create a rule that grants the premium role on order completion:
    • After updating an order
    • If the order state is Completed
    • And the order contains our premium product
    • Add a role to the user who is the owner of the order

That's really all there is to it.

Posted December 16, 2011

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
X
In 2019 Commerce Guys rebranded to Centarro.

Change is at the center of eCommerce, but our team and mission remain the same.

Our consulting, development, and support offerings apply our expertise to help you adapt to change and grow.

Find us now at: https://www.centarro.io