1

I have an Ubercart ecommerce Drupal 7 site I'm building. The user can either subscribe (monthly/annually) or purchase node by node (pay as you go).

I need to GRANT the subscriber or purchaser access to the main body field of the product node only, as teasers and image fields etc will be used elsewhere on the site. (This rules out a few node_access options)

I would like to combine the permissions in my own custom module, as the I can't see any contrib permissions modules that fit my needs. e.g. Node access product.

Is there an simple custom way to ALLOW access to a field after I have checked if the user has:

a) Purchased this node, or
b) is a subscriber with access (I'm using uc_recurring for ROLE assign on purchasing a subscription).

I think it could due done manually in a module checking directly for current logged in users role(s) and purchases (nid's) and seeing is the logic plays out, but will this be slow on performance when there are 1000's users and 1000's products?

Please let me know if you need any more information or if I'm on the right track.

bumped to the homepage by Community 23 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

I think the Field Permissions module may be able to handle all your needs.

Whilst you couldn't have a different permission for the teaser text of a node you could just separate this out into a separate field and then apply an individual permission there.

  • How would Field Permissions handle the "purchased node access"? I think it's purely ROLE based (drupal.org/files/images/field_permissions.jpg) – Joe Mewes Apr 24 '14 at 15:00
  • It is only role based however users can essentially purchase a role, and that role grants access to content. Ubercart supports buying roles. See this article: Selling Site Access (Role Assignments) – Felix Eve Apr 24 '14 at 15:22
  • Thanks, but role-base access wouldn't work on a per-product (i.e. node by node) basis. I have 2 rules that I need to check for, and EITHER can be true to ALLOW access. Either USER HAS ROLE == SUBSCRIBER, or USER HAS PURCHASED THIS NODE. It's the combination of both that I'm trying to implement. thanks though. – Joe Mewes Apr 24 '14 at 15:34
  • Damn - sorry that won't work. Maybe be a case for writing a custom permissions module for your exact needs then... – Felix Eve Apr 24 '14 at 15:38

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.