How to change role assigned on license purchase

Created on 22 November 2020, over 4 years ago
Updated 8 August 2024, 8 months ago

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

πŸ’¬ Support request
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

πŸ‡¬πŸ‡§United Kingdom nattyweb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΉπŸ‡·Turkey rgnyldz

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

  • Status changed to Fixed 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    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.

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

Production build 0.71.5 2024