Drupal auto change user role in module
- by Marques
I am trying to write a module that will change a user's permissions once a node form is inserted into the database. I already have a role assigned when a user registers, but i want that role to be changed once they create a 'company' profile in this case which is when they fill out a cck form of 'company_post' type. My code is below...
switch ($op) {
case 'insert':
if ($node->type == 'company_post') {
}
?
im not sure what to put in the if statement because I don't really know how to reference the users roles or how to change them.
?
So my question is what code can I use to change the users current role to a new role? (Both roles are already created in drupal and have seperate permissions)