diff --git a/profile_role.module b/profile_role.module
index 35d1f37..1c7156b 100644
--- a/profile_role.module
+++ b/profile_role.module
@@ -6,6 +6,8 @@
  * Copyright 2008 by Jimmy Berry ("boombatower", http://drupal.org/user/214218)
  */
 
+define('onchange_submit_value', '1');
+
 /**
  * Implementation of hook_menu().
  */
@@ -76,6 +78,8 @@ function profile_role_form_user_register_alter(&$form, $form_state) {
   }
 
   $roles = isset($form_state['post']['roles']) ? $form_state['post']['roles'] : array();
+  //allow other modules a hook to show profile_fields.
+  $roles = module_invoke_all('profile_role_show_roles_fields',$roles);
   $category_roles = profile_role_get_roles();
   $result = db_query('SELECT DISTINCT(category)
                       FROM {profile_fields}');
@@ -86,7 +90,7 @@ function profile_role_form_user_register_alter(&$form, $form_state) {
 
       if (isset($category_roles[$category])) {
         foreach ($category_roles[$category] as $rid) {
-          if (array_key_exists($rid, $roles)) {
+          if (in_array($rid, $roles)) {
             $remove = FALSE;
           }
         }
@@ -99,7 +103,10 @@ function profile_role_form_user_register_alter(&$form, $form_state) {
   }
 
   // Submit the form so that any additional fields display.
-  $form['account']['roles']['#attributes']['onchange'] = 'submit()';
+  // added admin setting to turn onchange_submit
+  if(variable_get('onchange_submit', onchange_submit_value)){
+    $form['account']['roles']['#attributes']['onchange'] = 'submit()';
+  }
 }
 
 /**
@@ -139,6 +146,14 @@ function profile_role_restrict_form(&$form_state) {
     drupal_goto('admin/user/profile');
   }
 
+  //add option to toggle onchange_submit
+  $form['onchange_submit'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable submit onchange role'),
+    '#description' => 'if checked changing roles will submit form',
+    '#default_value' => variable_get('onchange_submit', onchange_submit_value),
+  );
+
   $form['op'] = array(
     '#type' => 'submit',
     '#value' => t('Save configuration')
@@ -160,6 +175,8 @@ function profile_role_restrict_form_submit($form, &$form_state) {
     }
   }
 
+  //save onchange_submit value
+  variable_set('onchange_submit', $form['onchange_submit']['#value']);
   drupal_set_message(t('The configuration options have been saved.'));
 }
 
@@ -210,3 +227,8 @@ function profile_role_prune_roles() {
     db_query("DELETE FROM {profile_role} WHERE category = '%s'", $category);
   }
 }
+
+//added function to allow other modules to hook alter and pass $roles
+function profile_role_show_roles_fields($roles) {
+  return $roles;
+}
\ No newline at end of file
