Wednesday, August 18, 2010

Granting new roles to DRUPAL users using Ubercart

So you want to great new roles to users using Ubercart...

Welcome to the right place.

Step 1
First you need to make sure you have create the DRUPAL roles you will want to assign.

Step 2
Then you need to make sure you have installed Ubercart module and turned on the following modules in "Module" list:

  • Ubercart - Core (all)
  • Ubercart - Core - Optional (Catalog, Roles)
Step 3
Now you need to create the categories (or for Ubercart, "Classes") of products you will want to create. I knew I had two main types of roles with two sub roles in each main type. So I went to "Store Administration >>> Products >>> Manage Classes" and added two classes for my two main role types.

Doing this creates two new content types within DRUPAL.

Step 4
However before I can create my instances of these new content types I need to add category terms to the Ubercart Catalog, which is ultimately responsible for the grouping and presentation of my products on my website. To do this I need to go to "Content management >>> Taxonomy >>> List" and select the "Add Terms" for the Catalog taxonomy list.

I added two terms, Role Type A and Role Type B.

Step 5
Now you need to create the actual products that a customer will buy and that will grant them a new role.

To create the content go to "Content management >>> Create Content" and select the appropriate content node type. Then fill in the required information, make sure to select the appropriate catalog category and hit save.

You now have a product that you can play with.

Step 6
Click on "Content management >>> Content" to view a list of all your site content. Find your newly created content and select "edit". Find and select the "features" menu item, make sure that "Add new feature" is set to "Role assignment" and hit the "Add" button.

Chose the "SKU" value that corresponds to this product, select the appropriate role that you want granted once a customer purchases this product, make any other setting adjustments and then hit "save feature"

Step 7
Now you should be able to go to your website's catalog, select the product that will grant the role, purchase the product, and upon successful completion of payment you will:

  • Receive an e-mail from the website to your user account e-mail address notifying you of your role addition
  • Be given a new role for the website

Note: it is important to make sure that user can see the catalog to buy the role. Therefore you need to make sure the proper permissions are in place for "view catalog".

- Daniel Casey



No comments:

Post a Comment