diff --git a/sites/all/modules/autoassignrole/autoassignrole.module b/sites/all/modules/autoassignrole/autoassignrole.module index abec22d..f3cba45 100644 --- a/sites/all/modules/autoassignrole/autoassignrole.module +++ b/sites/all/modules/autoassignrole/autoassignrole.module @@ -140,6 +140,19 @@ function autoassignrole_perm() { */ function autoassignrole_user($op, &$edit, &$account, $category = NULL) { switch ($op) { + case 'view': + if(module_exists('content_profile')) { + $profile_types = content_profile_get_types('names', 'registration_use'); + if(is_array($profile_types)) { + foreach($profile_types as $type => $typename) { + $enabled = variable_get('autoassignrole_content_profile_'. $type, 0); + if(!isset($account->roles[$enabled])) { + unset($account->content['content_profile']['content_profile_' . $type]); + } + } + } + } + break; case 'insert': $path = drupal_get_path_alias($_GET['q']); $page = db_fetch_object(db_query("SELECT rid FROM {autoassignrole_page} WHERE path = '%s'", $path)); @@ -374,7 +387,7 @@ function _autoassignrole_array_asc($a, $b) { } function autoassignrole_form_alter(&$form, $form_state, $form_id) { - if ($form_id == 'node_type_form' && module_exists('content_profile')) { + if ($form_id == 'node_type_form' && module_exists('content_profile')) { $result = db_query("SELECT ar.path, ar.rid, r.name FROM {autoassignrole_page} ar INNER JOIN {role} r ON ar.rid = r.rid"); $options = array(); $options[0] = "All Registration forms";