[development] Assigning user to roles programatically

Bèr Kessels ber at webschuur.com
Fri Jan 27 09:29:19 UTC 2006


It sounds like this would be a valuable asset to core (post 4.7 please :))

> function module_user($op, &$edit, &$user) {
>      switch ($op) {
>        case 'insert' :
>          $edit['roles'][_user_get_rid('administrator')] = '';
>          $edit['roles'] = array_flip(array_keys($edit['roles'])); //
> I am not sure it's strictly necessary, but it maintains the format
> that the modules are expecting, so it can't hurt
>          break;
>     }
> }

Bèr

-- 
 [ Bèr Kessels | Drupal services www.webschuur.com ]


More information about the development mailing list