UC Clear Roles

Categories

Component ID

1219984

Component name

UC Clear Roles

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

284

Component created

Component changed

Component body

This module is the result of the conversation in http://www.ubercart.org/forum/support/9952/need_remove_role_purchase.

Use case

  • We have a product Silver associated with a Silver role and a product Gold associated with a Gold role. We also have other roles in our site independent of memberships.
  • A user buys a Silver Membership.
  • A few days later, before the actual expiration of the Silver Membership, the user decides to buy the Gold Membership.
  • By default, the user will have both Silver and Gold roles.
  • UC Clear Roles is responsible for fixing exactly this by removing the Silver role. Ubercart does the rest.

Notice:
In the example above, the user loses all days he would normally be allowed to remain as Silver and immediately changes to Gold as a new membership and not as a renewal..
In case a Gold user buys another Gold membership product before the actual expiration of the first package, this module does nothing and expiration time gets appended(and not resetted).

This module also respects other roles that may exist in your system but are independent of memberships(ex. admin, article-writer, editor). For choosing which roles are memberships and which are not, an administration page exists for the administrator to choose.

UC Clear Roles works with Conditional Actions and not with Rules. Therefore, it is only applicable to Ubercart 2.x and Drupal 6.x. There is no plan right now to make a port to D7.

How to make it happen:
1) Copy the module folder to your modules folder (usually /sites/all/modules) as usual.
2) Go to admin/store/settings/ucclearroles and choose the roles you want intact. If you have a administrator, editor or any other membership-independent role, this is the place to define them.
3) Go to admin/store/ca/overview. There, you will have to change the weight of the Grant or renew purchased roles. Grant or renew purchased roles must get effect AFTER the uc_clear_roles gets effect. Eg. if Grant or renew purchased roles is 2, then uc_clear_roles must be 1 or 0 and NOT 2 or 3 or more.

This array must be filled with your extra roles(if any) in the drupal system that have nothing to do with the subscriptions. For example, you may have administrators, managers, forum-managers plus roles obtained with a subscription fee (like Bronze, Silver, Gold). If this is the case, then the extra_roles variable must be like this

Dependencies:
Drupal 6.x
Ubercart 2.x
Conditional Actions(included in Ubercart)