Drupal auto change user role in module
        Posted  
        
            by Marques
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Marques
        
        
        
        Published on 2010-05-03T03:12:50Z
        Indexed on 
            2010/05/03
            3:18 UTC
        
        
        Read the original article
        Hit count: 447
        
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)
© Stack Overflow or respective owner