Ooops ... I included a function from the notify module that I used for the hook_user reference that shouldn't be in there ... create autoassignrole.module with this code and not the previous ... Sorry about that<br><br>
<?php<br>define("AUTOASSIGNROLE_ROLE", "");<br>/**<br> * Implementation of hook_menu().<br> *<br> * @return array<br> */<br>function autoassignrole_menu($may_cache) {<br> $items = array();<br> if ($may_cache) {
<br> $items[] = array(<br> 'path' => 'admin/settings/autoassignrole',<br> 'title' => t('Auto Assign Role Settings'),<br> 'description' => t('Auto Assign Role Settings page.'),
<br> 'callback' => 'drupal_get_form',<br> 'callback arguments' => 'autoassignrole_settings',<br> 'access' => user_access('administer autoassignrole'),<br> );
<br> }<br> return $items;<br>}<br>function autoassignrole_settings() {<br> $form['autoassignrole_settings'] = array(<br> '#type' => 'fieldset',<br> '#title' => t('Auto Assign Role Settings'),
<br> '#collapsible' => FALSE,<br> '#collapsed' => FALSE,<br> );<br> $form['autoassignrole_settings']['AUTOASSIGNROLE_ROLE'] = array(<br> '#type' => 'textfield',
<br> '#title' => t('.'),<br> '#default_value' => variable_get('AUTOASSIGNROLE_ROLE', ''),<br> '#size' => 70,<br> '#maxlength' => 255,<br> '#description' => t('The role you want new users assigned to.')
<br> );<br> return system_settings_form($form);<br>}<br>/**<br> * Implementation of hook_perm().<br> * @return array<br> */<br>function autoassignrole_perm() {<br> return array('administer autoassignrole');<br>
}<br><br>/**<br> * Implementation of hook_user().<br> */<br>function autoassignrole_user($type, &$edit, &$user, $category = NULL) {<br> switch ($type) {<br> case 'insert':<br> $sql = "SELECT
r.rid FROM {role} r WHERE <a href="http://r.name">r.name</a> = '%s'";<br> $role = db_fetch_object(db_query($sql,variable_get('AUTOASSIGNROLE_ROLE','')));<br> db_query('INSERT INTO {users_roles} (uid, rid) values (%d, %d)', $user->uid, $role->rid );
<br> break;<br> }<br>}<br><br><br><br>