Problem/Motivation

I need to assign a role (subscriber) and remove one (registered) on purchase of the license. Is this possible via the admin interface, or failing that, via code?

I thought there was an admin config page for commerce_license but I can no longer see it.

Please advise!

Thanks
Martin

Comments

nattyweb created an issue. See original summary.

rgnyldz’s picture

This could be usefull, I also have a case where users can upgrade their licences. So the old one should be removed.

rszrama’s picture

Version: 8.x-2.0-alpha18 » 8.x-2.x-dev
Status: Active » Fixed

Unfortunately, this is just not how the Role license type works. It exists to grant a role to a user upon license activation, not to revoke a secondary role. Your options are to create your own license type that supports this logic, react to license activation to toggle that secondary role in an event subscriber, or hook into some other means of observing when roles change to make it happen. It's possible the ECA module would have features to support this without code, but I haven't looked into it myself.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.