Grant Role on Product Purchase



This module is abandoned: Support for granting roles will be covered in the 1.0-alpha8 release by the new uc_roles module.


This module permits to grant a role to a user on product purchase. A new 'role' tab appears when you edit a product (eg: node/15/edit/role) and you can enter the role to grant on purchase.

If uc_expiry.module is enabled, and if you set an expiry to the product, then the role will be removed when the product expire. Note that once a user purchased an expirable product that gives a role, then the role setting for that product can't be changed.

The role is granted only when payment is accepted. So it means that for now you have to change the status of the order from 'Pending' to 'Processing' manually.

It seems that handling of order statuses is still in development in ubercart for now, so I'm not sure how to handle that in a better way. I mean:

  • there is no need for 'Shipment pending' and 'Shipped' statuses for this kind of product
  • it would be great to move the order status to 'post_payment' automatically when the payment confirmation is received from Paypal

Any feedback from the core ubercart team welcome Smiling

The module hooks into uc_notify.module (admin/store/settings/notify/edit/role) to send mails:

  • when a role is granted
  • when a role is renewed before expiry
  • when a role is going to expire soon (reminder)
  • when a role is lost

That's it for now.

Remember that this is beta code... not in production for now... bla bla bla bla... use it at your own risk... bla bla bla bla....


  • Fixed role status theming
  • Correctly clear cache on role addition/removal

uc_role-5.x-1.0-alpha3.tar.gz6.15 KB
Lowell's picture
Joined: 08/16/2007
Juice: 60
Re: Grant Role on Product Purchase

This would be a great feature, Right now e_commerce does this with paypal. When the payment is complete at the paypal site, the status in the e_commerce transaction list changes from pending to completed.

Although, there are many glitches and bugs, for example the roles don't expire, aren't transferred to the embedded gallery, etc.

I am suggesting to take a look at how they did this, maybe you can use those techniques?

jenm's picture
Joined: 09/23/2007
Juice: 24
Re: Re: Grant Role on Product Purchase

Nice module. Is there a way to modify it so that the new user role is granted once an order has been submitted instead of once it's complete?