I am trying to alter the way commerce_file module shows the product file in the Product display. Actually it is shown to all users owning sort of administrative permissions (such as administer commerce_file or administer commerce_field type). Its format is:
label: file.pdf
This code is driven by the
commerce_file_field_access($op, $field, $entity_type, $entity = NULL, $account = NULL)
function in commerce_file module itself, it seems.
I would like with my_module to override this behavior to make the file visible to users that doesn't own those permissions but that have already bought the digital product and had license granted for that, but really don't know how to. (I already succeeded in disabling the add to chart button)
I am able to define if the user/buyer already bought it, but just cannot override the module access conditions to apply my rules.
I already tried defining another function like my_module_field_access()
, but it doesn't seem to work...
How is it possible to override the hook_field_access()
function already defined in commerce_file module?
As an alternative I was minding to replicate/copy that field and render it again without that access control, just in the defined conditions I define in my module.
To do that I tried with a my_module_preprocess_node()
function, but didn't succeeded. The new $vars['elements']
is not rendered ...
I hope have been sufficiently clear. really any advice (on the best approach & way) would be very welcome. Wasted so many hours on this ... yet. Thanks so much