Are you trying to restrict the purchase process or the file download process?
Thread Starter
No3x
(@no3x)
Both. I want to limit the access for users/groups – if they are not in the group anymore: no products view, no access, no download.
You say “not a single one of the large WordPress ecommerce plugins has ever gotten really right” – so let me show you my point of view as input for improvement / features:
I need a user control system with groups. The users are members of groups according to their maintenance contract. If the contract expires they will be expelled from the group. Each download requires a specific group.
At this moment I implemented this by adapting some 3rd party plugins. But I think it’s better to implement it right into edd.
How are you determining a group? Is it a user role?
Thread Starter
No3x
(@no3x)
At this moment I assign capabilities to groups with a plugin called groups. In the second step I restrict the access to a download/post by asking for a specific capability that shouldd be given by a group. There are no roles affected. (Another plugin)
E.g. group toy gets capability toy. Group flowers gets capability flowers. In the post I restrict by asking for capability “toy”. The user which is in group toy will see the download about toy.
Ok cool. You should be able to hook into the edd_process_verified_download
action to check if the user has the appropriate cap.
Thread Starter
No3x
(@no3x)
Hello, thank you very much for your help.
But the mentioned hook is not usefull for my requirements. I don’t want to show the download at all, if the user has not the caps. The download shouldn’t appear on the whole blog.
So I have to check far before edd_process_verified_download
.
Do you have an idea?
You could hook into the “template_direct” action and check if the ID of the displayed page.