Loading role_export.install +8 −4 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ */ /** * Implementation of hook_schema_alter. * Implements hook_schema_alter(). */ function role_export_schema_alter(&$schema) { // Add machine_name field to the 'role' table. Loading @@ -20,7 +20,7 @@ function role_export_schema_alter(&$schema) { } /** * Implementation of hook_install(). * Implements hook_install(). */ function role_export_install() { db_add_field('role', 'machine_name', array( Loading @@ -33,7 +33,11 @@ function role_export_install() { // Update any existing roles (except anonymous, authenticated) to have a // machine name and save it to the 'role' table. $roles = db_query("SELECT rid, name FROM {role} WHERE rid != 1 AND rid != 2"); $roles = db_select('role') ->fields('role', array('rid', 'name')) ->condition('rid', array(1, 2), 'NOT IN') ->execute() ->fetchAll(); foreach ($roles as $role) { $rid = $role->rid; $machine_name = 'role-' . str_replace(' ', '_', strtolower($role->name)); Loading @@ -47,7 +51,7 @@ function role_export_install() { } /** * Implementation of hook_uninstall(). * Implements hook_uninstall(). */ function role_export_uninstall() { db_drop_field('role', 'machine_name'); Loading role_export.module +5 −2 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ */ /** * Implementation of hook_form_alter(). * Implements hook_form_alter(). */ function role_export_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { Loading Loading @@ -77,7 +77,7 @@ function role_export_submit($form, &$form_state) { } /** * Implementation of hook_theme(). * Implements hook_theme(). */ function role_export_theme() { return array( Loading Loading @@ -113,6 +113,9 @@ function role_export_roles() { return $roles; } /** * Implements hook_user_role_insert(). */ function role_export_user_role_insert($role) { // Use the role name if no machine name is present. // Generate a machine name from the role name if the machine name is not Loading Loading
role_export.install +8 −4 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ */ /** * Implementation of hook_schema_alter. * Implements hook_schema_alter(). */ function role_export_schema_alter(&$schema) { // Add machine_name field to the 'role' table. Loading @@ -20,7 +20,7 @@ function role_export_schema_alter(&$schema) { } /** * Implementation of hook_install(). * Implements hook_install(). */ function role_export_install() { db_add_field('role', 'machine_name', array( Loading @@ -33,7 +33,11 @@ function role_export_install() { // Update any existing roles (except anonymous, authenticated) to have a // machine name and save it to the 'role' table. $roles = db_query("SELECT rid, name FROM {role} WHERE rid != 1 AND rid != 2"); $roles = db_select('role') ->fields('role', array('rid', 'name')) ->condition('rid', array(1, 2), 'NOT IN') ->execute() ->fetchAll(); foreach ($roles as $role) { $rid = $role->rid; $machine_name = 'role-' . str_replace(' ', '_', strtolower($role->name)); Loading @@ -47,7 +51,7 @@ function role_export_install() { } /** * Implementation of hook_uninstall(). * Implements hook_uninstall(). */ function role_export_uninstall() { db_drop_field('role', 'machine_name'); Loading
role_export.module +5 −2 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ */ /** * Implementation of hook_form_alter(). * Implements hook_form_alter(). */ function role_export_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { Loading Loading @@ -77,7 +77,7 @@ function role_export_submit($form, &$form_state) { } /** * Implementation of hook_theme(). * Implements hook_theme(). */ function role_export_theme() { return array( Loading Loading @@ -113,6 +113,9 @@ function role_export_roles() { return $roles; } /** * Implements hook_user_role_insert(). */ function role_export_user_role_insert($role) { // Use the role name if no machine name is present. // Generate a machine name from the role name if the machine name is not Loading